executing java -jar via classpath vs in the jar file dir

谁说我不能喝 提交于 2019-12-02 11:24:05

The -classpath argument is ignored when you use the -jar option. See the documentation.

because java doesn't look in classpath to launch jar file for this command it needs file as input

so if you set the directory where your jar file is placed and try to execute java -jar command and expect it to pick up jar from that directory because it is in classpath it is not valid

you can give full path to jar like from any directory

java -jar c:\Users\Ben\Doc\NetBeansProjects\Addition\dist\Addition.jar
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!