更新时间:2022-01-30 22:18:04
如果你说 -cp somejar.jar
你要将 somejar.jar
添加到类路径中。它只会尝试在您输入命令时从您当前所在的目录中找到 somejar.jar
。
If you say -cp somejar.jar
you are adding somejar.jar
to the classpath. It will only try to find the somejar.jar
from the directory you are currently in when you typed the command.
如果你在清单中说
Class-Path: somejar.jar
你是说将jar, somejar.jar
添加到清单所在目录的类路径中找到(也就是在jar中)。
you are saying add the jar, somejar.jar
into the classpath from the directory where the manifest is located(aka inside the jar).
作为旁注,当你使用-jar,-cp或-classpath指定类路径时,你会覆盖系统变量CLASSPATH。
As a side note, when you specify the classpath by using -jar, -cp, or -classpath, you override the system variable CLASSPATH.
更多细节可以在这里找到, http://docs.oracle.com/javase/tutorial/deployment/jar/downman.html
More details can be found here, http://docs.oracle.com/javase/tutorial/deployment/jar/downman.html