我应该如何设置CLASSPATH? [英] How should I set CLASSPATH?
问题描述
我之前是这样做的:
CLASSPATH =。:/ home / phoenies / jdk1.6.0_17 / lib / tools.jar :/home/phoenies/jdk1.6.0_17/lib/dt.jar
CLASSPATH=".:/home/phoenies/jdk1.6.0_17/lib/tools.jar:/home/phoenies/jdk1.6.0_17/lib/dt.jar"
但是今天有一篇文章说我应该这样做:
But today an article says I should do this:
CLASSPATH =。://home/phoenies/jdk1.6.0_17/lib
CLASSPATH=".:/home/phoenies/jdk1.6.0_17/lib"
如果这样做,它将搜索lib中的所有jar文件吗?
If I do so, will it search all the jar files in lib? So it's probably a shorter way?
推荐答案
由于使用的是JDK6,因此可以使用类路径通配符:CLASSPATH =。:/ home / phoenies / jdk1.6.0_17 / lib / *将匹配lib /
Since you are using JDK6, you can use classpath wildcards: CLASSPATH=".:/home/phoenies/jdk1.6.0_17/lib/*" will match all JARS inside lib/
中的所有JARS。请检出 http://java.sun.com/javase/6/docs/technotes/tools/windows/classpath.html 有一个名为了解类路径通配符的部分
Check out http://java.sun.com/javase/6/docs/technotes/tools/windows/classpath.html there's a section called "Understanding class path wildcards"
这篇关于我应该如何设置CLASSPATH?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!