I am trying to run a java based tool using a command line syntax as the following: java -cp archive.jar archiveFolder.theMainClassName.Although the class I am searching for, a main class, ‘theMainClassName’ is in the archive.jar and in the archiveFolder given at input, I keep getting the error that my class is not seen. Does anybody have any ideas concerning this problem? Thank you in advance
Share
Here’s a concrete example of what does work, so you can compare your own situation.
Take this code and put it anywhere, in a file called
MainClass.java. (I’ve assumed a directory calledsrclater. Normally you’d arrange the source to match the package, of course.)Then run each of these commands:
The result:
How are you building your jar file? Is the code in the appropriate package?