How is the Java classpath set on a Mac?

后端 未结 2 1124
青春惊慌失措
青春惊慌失措 2021-01-21 12:14

How is the Java classpath set on a Mac?

2条回答
  •  被撕碎了的回忆
    2021-01-21 12:49

    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.

提交回复
热议问题