第二个命令是否将当前路径添加为另一个搜索路径?
javac -cp /home/tim/program_files/programming/java/junit-4.11.jar MyTest.java
javac -cp .:/home/tim/program_files/programming/java/junit-4.11.jar MyTest.java
用冒号分隔多个路径是否正确?
默认情况下,当前路径不是总是在ClassPath中,因此不需要显式指定吗?
谢谢。
最佳答案
来自 Oracle 的 page关于设置类路径:
The default class path is the current directory. Setting the CLASSPATH variable or using the
-classpath
command-line option overrides that default, so if you want to include the current directory in the search path, you must include "." in the new settings.
使用 ;
用于 Windows 和 :
用于类 Unix 操作系统作为多个路径的分隔符。
关于java - 默认classpath中的当前路径是 `.`吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26246436/