java classpath in unix

混江龙づ霸主 提交于 2019-12-04 18:11:43

To specify multiple jars in a directory, directly in the java command, use this

java -cp "/sw/jar/*" org.antlr.Tool Calc.g

This will include all the jars

If you want to set the classpath in Unix/Linux systems, use this

export CLASSPATH=/sw/jar/a.jar:/sw/jar/b.jar

in unix use this to set the classpath:

export CLASSPATH=myClassPath

about not finding your jar, you're using a leading slash (/), that means that you path is absolute (not relative to your home folder) is this what you want?

if you want the path to be relative to your folder try:

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