Gatling Error: Could not find or load main class Engine

error: could not find or load main class scala intellij
error: could not find or load main class intellij
error: could not find or load main class eclipse
error: could not find or load main class mainkt
error: could not find or load main class eclipse maven
error: could not find or load main class maven
error: could not find or load main class cucumber api cli main
error: could not find or load main class org testng remote remotetestng

I installed the latest IntelliJ idea, latest maven 3.6.3, Java 1.8, set the JAVA_HOME / JRE_HOME env variables. Then generated a Gatling project using mvn archetype:generate -Dfilter=gatling. In summary, I followed the instruction here. I have installed the Scala plugin for IntelliJ idea as well. When I try to run the Gatling engine by right-clicking on the Engine class, I am getting below error. can someone tell me what's going on here? I tried all the suggestions online, but no luck so far. Thanks

"C:\Program Files (x86)\Java\jdk1.8.0_221\bin\java.exe".....

Error: Could not find or load main class Engine

Process finished with exit code 1 

Here is my POM file

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.mycompany.gatling</groupId>
  <artifactId>pert-tests</artifactId>
  <version>1.0-SNAPSHOT</version>

  <properties>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
    <encoding>UTF-8</encoding>

    <gatling.version>3.2.1</gatling.version>
    <gatling-maven-plugin.version>3.0.3</gatling-maven-plugin.version>
  </properties>

  <dependencies>
    <dependency>
      <groupId>io.gatling.highcharts</groupId>
      <artifactId>gatling-charts-highcharts</artifactId>
      <version>${gatling.version}</version>
    </dependency>
    <dependency>
      <groupId>io.gatling</groupId>
      <artifactId>gatling-app</artifactId>
      <version>${gatling.version}</version>
    </dependency>
    <dependency>
      <groupId>io.gatling</groupId>
      <artifactId>gatling-recorder</artifactId>
      <version>${gatling.version}</version>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>io.gatling</groupId>
        <artifactId>gatling-maven-plugin</artifactId>
        <version>${gatling-maven-plugin.version}</version>
      </plugin>
    </plugins>
  </build>
</project>

David Montaño... after manually marking src/test/scala as Test Sources Root, I got "Error:(11, 18) illegal cyclic inheritance" as mentioned by Rasika

I just found that scala 2.13.1 is not compatible with gatling. I removed scala 2.13.1 from global libraries list and added scala 2.12.10. Tests working fine now. Here are the steps

  1. Right click project folder in IntelliJ and choose 'Open Module Settings'

  2. Under 'Platform Settings' select 'Global Libraries'

  3. Here, remove scala-sdk-2.13.1 and add scala-sdk-2.12.10

  4. Rebuild the module

Error: Could not find or load main class - Question, I'm getting the following error message: Error: Could not find or load main class In fact I get quite a few hits which I search in google for this, but� The message ‘Could not find or load main class’ means that the first step of the Java engine fetching the class for execution has failed. The java command was not able to locate the class at the correct directory.

It worked for me when I manually marked the src/test/scala as Test Sources Root and rebuild the project.

Mark as Test Sources Root

It should be picked up automatically by IntelliJ but it wasn't the case.

Error: Could not find or load main class io.gatling.recorder , Google Groups allows you to create and participate in online forums and email- based groups with a rich experience for community� You can find our new documentation site and support forum for posting questions here. Be sure to read our welcome blog ! Error: Could not find or load main class org.broadinstitute.gatk.engine.CommandLineGATK

Tied both : marked the src/test/scala as Test Sources Root and rebuild the project.

Mark as Test Sources Root And Under 'Platform Settings' select 'Global Libraries'

Here, remove scala-sdk-2.13.1 and add scala-sdk-2.12.10

then works.

How to solve Error: Could not find or load main class?, Error: Could not find or load main class. When I execute a program for many times, suddenly I get this error. Later I could not run the program. When in console I wrote this command line : "java -jar path/to/file.jar" the output was "Error: Could not find or load main class mypk.Main" The manifest is into /resources directory: Manifest-Version: 1.0 Main-Class: mypk.Main. Ps: Inside the .jar, the content of the MANIFEST.MF is the same.

Could Not Find or Load Main Class Error, Explore the reasons for the error "Could not find or load main class" and learn how to avoid them. If you are getting "Error: Could not find or load main class XXX", where XXX is the name of your main class while running Java program then do this to solve that error: 1) If you are running Java program right from the directory where .class file is and you have CLASSPATH environment variable defined then make sure it include current directory.

IntelliJ could not find or load main class � Issue #11 � nus-cs2103 , After I clone the addressbook-level1 on my computer and built the project in IntelliJ, when I tried to run AddressBook, the following error� Edit: Your manifest jar contains the wrong classpath. Try using testCompile files: task manifestJar(dependsOn:'compileTestScala',type: Jar) { dependsOn configurations.testCompile archiveName 'gatlingBooter.jar' doFirst { manifest { // uri is just needed for Windows-compatibility attributes 'Class-Path': configurations.testCompile.files.collect{ project.uri(it) }.join(' ') } } } OLD: If the

Cannot find or load main class – IDEs Support (IntelliJ Platform , I am trying to run a Java program like: $ java -jar Neo4jImport.jar. But I get. Error: Could not find or load main class MongoDBImport.App OfflineToolStart, NoClassDefFoundError, exit code -21003, java, deployment, com.sap.engine.offline.OfflineToolStart , KBA , BC-JAS-COR , Enterprise Runtime, Core J2EE

Comments
  • Been struggling with this issue on and off for ages with Gatling... this solution downgrading to 2.12 finally worked. Thanks!
  • Thanks for the reply, Still the same issue @David Montaño, The solution compiles fine, however when I have a look at the solution folders, I am unable to find any bin folder with complied binaries, Could that be the reason?
  • I tried adding scala SDK 2.13.1 to Global Libraries in project settings, now i m getting a compilation error as Error:(11, 18) illegal cyclic inheritance involving trait Iterable Gatling.fromMap(props.build)