I am trying to run my program via the command line using Maven. The location of the class which starts everything off is projectFolder -> src -> frogger -> game -> MainMenu.java
I've tried running mvn evec:java
and I am getting the following error:
[WARNING]
java.lang.ClassNotFoundException: frogger.game.MainMenu
at java.net.URLClassLoader.findClass (URLClassLoader.java:466)
at java.lang.ClassLoader.loadClass (ClassLoader.java:566)
at java.lang.ClassLoader.loadClass (ClassLoader.java:499)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run (ExecJavaMojo.java:281)
at java.lang.Thread.run (Thread.java:844)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.510 s
[INFO] Finished at: 2019-12-17T17:50:48Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.4.0:java (default-cli) on project mainProject: An exception occured while executing the Java class. frogger.game.MainMenu -> [Help 1]
I've already tried running mvn clean install
then mvn exec:java
as suggested in this thread: Class Not Found exception with exec-maven-plugin when run on Linux but the issue still persists.
I've also tried running mvn exec:java -D"exec.mainClass"="frogger.game.MainMenu"
which I found elsewhere but it gave me the same issue as above.
EDIT: Managed to fix it by rearranging my folder structure to match src/main/java