java -jar:默认的 class 路径是什么?
java -jar: What's the default class path?
在 jar 文件中,MANIFEST.mf
包含以下行:
款式A:
Class-Path: .
风格B:
Class-Path: . eric-java-util_lib/tomcat-api.jar
样式 C:
// No `Class-Path` specified.
问题:
- 样式B中,
Class-Path
指定的jar是否与当前jar的驻留目录相关?
- 那么在风格A和风格B中,
.
是什么意思呢?是未压缩的 jar 根目录,还是当前 jar 的驻留目录?我想应该是后者,但不确定。
- 似乎 类 和
MANIFEST.mf
之外的包也包含在所有 3 种样式的类路径中,是由于 .
吗?或者,java -jar
的默认类路径只是解压 jar 文件的根目录?
In style B, is the jar specified by Class-Path
related to residing dir of current jar?
是的(请参阅下面的 Java SE 文档注释)。
Then in style A and B, what does .
mean? Is it uncompressed root dir of jar, or the residing dir of current jar? I guess it should be the later, but not sure.
它是 jar 的驻留目录(参见下面的 Java SE 文档)。
It seems classes & packages besides MANIFEST.mf
are also included in classpath in all the 3 styles, is it due to .
? Or, the default classpath for java -jar
is just the root dir of uncompress jar file?
如Java SE Documentation: How the Java Launcher Finds User Classes所述:
The default value, ".", meaning that user class files are all the class files in the current directory (or under it, if in a package).
...
The JAR archive specified by the -jar option, which overrides all other values. If this option is used, all user classes must come from the specified archive.
当您使用 java -jar
时,以下内容适用:
In style B, is the jar specified by Class-Path related to residing dir of current jar?
所有款式都和'residing dir of current jar'有关
Then in style A and B, what does . mean?
表示.jar文件所在目录
Is it uncompressed root dir of jar
没有
or the residing dir of current jar?
是的。
I guess it should be the later, but not sure.
是的。确定。
It seems classes & packages besides MANIFEST.mf are also included in classpath in all the 3 styles, is it due to .?
我不知道'besides MANIFEST.mf'是什么意思。
Or, the default classpath for java -jar is just the root dir of uncompress jar file?
java -jar
除了 .jar 文件本身和 Class-Path
清单条目中指定的任何内容外,没有默认类路径。
在 jar 文件中,MANIFEST.mf
包含以下行:
款式A:
Class-Path: .
风格B:
Class-Path: . eric-java-util_lib/tomcat-api.jar
样式 C:
// No `Class-Path` specified.
问题:
- 样式B中,
Class-Path
指定的jar是否与当前jar的驻留目录相关? - 那么在风格A和风格B中,
.
是什么意思呢?是未压缩的 jar 根目录,还是当前 jar 的驻留目录?我想应该是后者,但不确定。 - 似乎 类 和
MANIFEST.mf
之外的包也包含在所有 3 种样式的类路径中,是由于.
吗?或者,java -jar
的默认类路径只是解压 jar 文件的根目录?
In style B, is the jar specified by
Class-Path
related to residing dir of current jar?
是的(请参阅下面的 Java SE 文档注释)。
Then in style A and B, what does
.
mean? Is it uncompressed root dir of jar, or the residing dir of current jar? I guess it should be the later, but not sure.
它是 jar 的驻留目录(参见下面的 Java SE 文档)。
It seems classes & packages besides
MANIFEST.mf
are also included in classpath in all the 3 styles, is it due to.
? Or, the default classpath forjava -jar
is just the root dir of uncompress jar file?
如Java SE Documentation: How the Java Launcher Finds User Classes所述:
The default value, ".", meaning that user class files are all the class files in the current directory (or under it, if in a package).
...
The JAR archive specified by the -jar option, which overrides all other values. If this option is used, all user classes must come from the specified archive.
当您使用 java -jar
时,以下内容适用:
In style B, is the jar specified by Class-Path related to residing dir of current jar?
所有款式都和'residing dir of current jar'有关
Then in style A and B, what does . mean?
表示.jar文件所在目录
Is it uncompressed root dir of jar
没有
or the residing dir of current jar?
是的。
I guess it should be the later, but not sure.
是的。确定。
It seems classes & packages besides MANIFEST.mf are also included in classpath in all the 3 styles, is it due to .?
我不知道'besides MANIFEST.mf'是什么意思。
Or, the default classpath for java -jar is just the root dir of uncompress jar file?
java -jar
除了 .jar 文件本身和 Class-Path
清单条目中指定的任何内容外,没有默认类路径。