Run java without specifying classpath on the command line

前端 未结 1 968
说谎
说谎 2021-01-23 13:05

I\'ve specified the main class and classpath for a java program in the .jar file manifest, but occasionally I want to run a different class from the one specified by the M

相关标签:
1条回答
  • 2021-01-23 13:34

    Just put the jar file on the command line with -cp; Java will then observe the classpath attribute within the manifest, even though you're not using -jar:

    java -cp app.jar MyOtherClass
    
    0 讨论(0)
提交回复
热议问题