开发者

How is the Java classpath set on a Mac?

How is the Java cl开发者_运维百科asspath set on a Mac?


Since you tagged the question with tomcat, I'll assume that you're running a Java Servlet webapp.

In that case, the classpath covers the JAR files in /WEB-INF/lib folder of the webapp and all class files in /WEB-INF/classes folder of the webapp. So you've to drop the 3rd party JAR files and/or your classes exactly there to get them to be visible in the runtime classpath of the webapp.

The %CLASSPATH% environment variable is by the way ignored by everything else than the java executabele which is executed without -jar, -cp and -classpath arguments. Don't use it for webapps.


On Mac OS X, I stopped using the CLASSPATH environment variable some time ago; I now set it for each project. Too often, I would forget about older, conflicting JARs hiding in the forgotten recesses of an ever growing list of paths. In particular, I don't know of a reason to set it for Tomcat. If you're curious, $CATALINA_HOME/bin/setclasspath.sh may be informative.

If you need it for some other reason, the bash incantation to include this or that is shown below:

export CLASSPATH=.:/opt/this/this.jar:/opt/that/that.jar:…
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜