I have a bunch of .jar files in a folder called "staged".
/target
/staged
- akka-slf4j_2.10.0-RC1-2.1.0-RC1.jar
- play_2.10-2.1-RC1.jar
- etc...
While my current directory is "target", I try to run the command
$ java -cp ./staged/* play.core.server.NettyServer ./..
Error: Could not find or load main class ..staged.akka-slf4j_2.10.0-RC1-2.1.0-RC1.jar
It's bizzarre that Java is looking for a main class in staged.akka-slf4j_2.10.0-RC1-2.1.0-RC1.jar. The NettyServer class is inside a completely different .jar file called play_2.10-2.1-RC1.jar. How does Java decide which .jar files to search in order to find the main method?
Java doesn't search a specific jar-file. It simply searches the resulting classpath for the class that you have specified on the command line.
Edit: Unless you specify '-jar', in which case it uses the Main-Class directive of the MANIFEST.MF file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With