在tomcat启动的时候,tomcat不会用JDK的classpath,这个是在tomcat启动的catalina.sh里面设置的
在catalina.sh的一百八十行左右的代码:
# Add on extra jar files to CLASSPATH
if [ ! -z “KaTeX parse error: Can't use function '\]' in math mode at position 12: CLASSPATH" \̲]̲ ; then CLASS…CLASSPATH”:
fi
CLASSPATH=“
C
L
A
S
S
P
A
T
H
"
"
CLASSPATH""
CLASSPATH""CATALINA_HOME”/bin/bootstrap.jar
if [ -z “KaTeX parse error: Can't use function '\]' in math mode at position 16: CATALINA\_OUT" \̲]̲ ; then CATAL…CATALINA_BASE”/logs/catalina.out
fi
if [ -z “KaTeX parse error: Can't use function '\]' in math mode at position 19: …ALINA\_TMPDIR" \̲]̲ ; then \# De…CATALINA_BASE”/temp
fi
# Add tomcat-juli.jar to classpath
# tomcat-juli.jar can be over-ridden per instance
if [ -r "KaTeX parse error: Can't use function '\]' in math mode at position 37: …mcat-juli.jar" \̲]̲ ; then CLASS…CLASSPATH:
C
A
T
A
L
I
N
A
_
B
A
S
E
/
b
i
n
/
t
o
m
c
a
t
−
j
u
l
i
.
j
a
r
e
l
s
e
C
L
A
S
S
P
A
T
H
=
CATALINA\_BASE/bin/tomcat-juli.jar else CLASSPATH=
CATALINA_BASE/bin/tomcat−juli.jarelseCLASSPATH=CLASSPATH:$CATALINA_HOME/bin/tomcat-juli.jar
fi
如果需要把自己的目录加进去的话,在下面加一句
# Add tomcat-juli.jar to classpath
# tomcat-juli.jar can be over-ridden per instance
if [ -r "KaTeX parse error: Can't use function '\]' in math mode at position 37: …mcat-juli.jar" \̲]̲ ; then CLASS…CLASSPATH:
C
A
T
A
L
I
N
A
_
B
A
S
E
/
b
i
n
/
t
o
m
c
a
t
−
j
u
l
i
.
j
a
r
e
l
s
e
C
L
A
S
S
P
A
T
H
=
CATALINA\_BASE/bin/tomcat-juli.jar else CLASSPATH=
CATALINA_BASE/bin/tomcat−juli.jarelseCLASSPATH=CLASSPATH:
C
A
T
A
L
I
N
A
_
H
O
M
E
/
b
i
n
/
t
o
m
c
a
t
−
j
u
l
i
.
j
a
r
f
i
C
L
A
S
S
P
A
T
H
=
CATALINA\_HOME/bin/tomcat-juli.jar fi CLASSPATH=
CATALINA_HOME/bin/tomcat−juli.jarfiCLASSPATH=CLASSPATH:自己的目录
然后重启