Skip to content

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

@Jerryy959

Description

@Jerryy959

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions