Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"java.lang.ClassNotFoundException: examples.Example1" When run Example1. #31

Open
Jerryy959 opened this issue May 6, 2022 · 4 comments

Comments

@Jerryy959
Copy link

Hi,
I'm running the project "Via Command Line". I use mvn clean install and all is well.

But when i enter mvn exec:java -Dexec.mainClass="examples.Example1", I get the error , the whole output follows:

[INFO] Scanning for projects...
[INFO]
[INFO] ---------------------< com.mechalikh:pureedgesim >----------------------
[INFO] Building PureEdgeSim 5.0.0
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- exec-maven-plugin:3.0.0:java (default-cli) @ pureedgesim ---
[WARNING]
java.lang.ClassNotFoundException: examples.Example1
    at java.net.URLClassLoader.findClass (URLClassLoader.java:382)
    at java.lang.ClassLoader.loadClass (ClassLoader.java:418)
    at java.lang.ClassLoader.loadClass (ClassLoader.java:351)
    at org.codehaus.mojo.exec.ExecJavaMojo$1.run (ExecJavaMojo.java:246)
    at java.lang.Thread.run (Thread.java:748)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.118 s
[INFO] Finished at: 2022-05-06T22:38:57+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:3.0.0:java (default-cli) on project pureedgesim: An exception occured while executing the Java class. examples.Example1 -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

How can i solve this problem?

@ban9975
Copy link

ban9975 commented Jun 5, 2022

Hi

I have this problem as well, and I solve it by configuring the library to jdk-16, hope this can help you.

@AI-4-Energy
Copy link

I have the same problem. Do we need a specific jdk / maven version to run the simulator?

@kevinsuo
Copy link

kevinsuo commented Oct 25, 2023

I have the following error:

administrator@CS4504-8 ~/PureEdgeSim> mvn exec:java -Dexec.mainClass="examples.Example1"
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.mechalikh:pureedgesim:jar:5.2.0
[WARNING] 'dependencies.dependency.systemPath' for net.sourceforge.jFuzzyLogic:jFuzzyLogic:jar should not point at files within the project directory, ${project.basedir}/PureEdgeSim/libs/jFuzzyLogic_v3.0.jar will be unresolvable by dependent projects @ line 378, column 16
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building PureEdgeSim 5.2.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- exec-maven-plugin:3.0.0:java (default-cli) @ pureedgesim ---
[WARNING]
java.lang.ClassNotFoundException: examples.Example1
	at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:433)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:586)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:519)
	at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:246)
	at java.base/java.lang.Thread.run(Thread.java:831)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.354 s
[INFO] Finished at: 2023-10-24T20:54:46-04:00
[INFO] Final Memory: 12M/50M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:3.0.0:java (default-cli) on project pureedgesim: An exception occured while executing the Java class. examples.Example1 -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

My JDK is openjdk 16:

administrator@CS4504-8 ~/PureEdgeSim> java --version
openjdk 16.0.1 2021-04-20
OpenJDK Runtime Environment (build 16.0.1+9-Ubuntu-118.04)
OpenJDK 64-Bit Server VM (build 16.0.1+9-Ubuntu-118.04, mixed mode, sharing)

Anyone knows how to solve it?

@kevinsuo
Copy link

I have the same problem. Do we need a specific jdk / maven version to run the simulator?

I also want to know it. Mine does not work.

administrator@CS4504-8 ~/PureEdgeSim> mvn --version
Apache Maven 3.2.3 (33f8c3e1027c3ddde99d3cdebad2656a31e8fdf4; 2014-08-11T16:58:10-04:00)
Maven home: /usr/local/apache-maven-3.2.3
Java version: 16.0.1, vendor: Private Build
Java home: /usr/lib/jvm/java-16-openjdk-amd64
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.4.0-150-generic", arch: "amd64", family: "unix"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants