更新时间:2023-01-14 22:18:39
Since you tagged the question with tomcat, I'll assume that you're running a Java Servlet webapp.
在这种情况下,类路径涵盖了Webapp的/WEB-INF/lib
文件夹中的JAR文件以及/WEB-INF/classes
文件夹中的所有类文件Webapp的因此,您必须将第三方JAR文件和/或您的类放到那里,以使其在Web应用程序的运行时类路径中可见.
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.
%CLASSPATH%
环境变量被 java 可执行文件(不执行 -jar
, -cp
和 -classpath
参数.请勿将其用于网络应用程序.
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.