Could not find or load <className> class due to structure change

Answered

Previously, project structure is like this: 

anotherFolderName

--- otherFolders

--- projectFolder <- created intellij project here (module root location)

--- --- .idea

--- --- src

--- --- lib

 

new project structure

anotherFolderName <- created intellij project here (module root location)

--- otherFolders

--- projecFolder

--- --- src

--- --- lib

 

Essentially, the the original project folder is moved one level deeper. 

After marking the /projectFolder/src folder as the source root and adjusting run-configuration, "Error: Could not find or load main class <main class name>" is printed in the console. 

Previous run configuration before modifying folder structure: 

1) specified the correct main class by selecting it from the "choose main class" popup

2) VM options: -cp product.jar -Duser.dir=<absolute path of the project folder > 

 

Inside run configuration, I have 

1) specified the correct main class by selecting it from the "choose main class" popup

2) VM options: -cp projectFolder/product.jar -Duser.dir=<absolute path of projectFolder> 

 

What can I do to resolve this issue? 

 

 

 

 

0
1 comment

Check your projectFolder/product.jar file. Since you override the default classpath, this jar may be packaged incorrectly and doesn't contain the main class at the correct location inside the jar.

0

Please sign in to leave a comment.