Run a JAR file from the command line and specify classpath

后端 未结 5 1110
耶瑟儿~
耶瑟儿~ 2020-11-22 10:44

I\'ve compiled a JAR file and specified the Main-Class in the manifest (I used the Eclipse Export function). My dependencies are all in a directory labeled li

5条回答
  •  花落未央
    2020-11-22 11:10

    You can do these in unix shell:

    java -cp MyJar.jar:lib/* com.somepackage.subpackage.Main
    

    You can do these in windows powershell:

    java -cp "MyJar.jar;lib\*" com.somepackage.subpackage.Main
    

提交回复
热议问题