Run a JAR file from the command line and specify classpath

后端 未结 5 1193
耶瑟儿~
耶瑟儿~ 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:07

    Run a jar file and specify a class path like this:

    java -cp  com.test.App
    

    jar_name.jar is the full name of the JAR you want to execute

    libs/* is a path to your dependency JARs

    com.test.App is the fully qualified name of the class from the JAR that has the main(String[]) method

    The jar and dependent jar should have execute permissions.

提交回复
热议问题