There is a jar file called myJar.jar in myfolder. I want to call myClass in this jar file, so can I know which command to enter?
I did java-cp myJar.jar.myClass, but I can't.
command-line-argument java jar
java -cp myjar.jar com.mypackage.myClass
Do it like this. Unless the class is in the package
java -cp myjar.jar myClass
You can say that.
The location to execute the command is myJar.Unless it's in the same directory as jar
On Linux,
java -cp /myfolder/myjar.jar com.mypackage.myClass
In Windows,
java -cp c:\myfolder\myjar.jar com.mypackage.myClass
You can say that.
© 2024 OneMinuteCode. All rights reserved.