开发者

Java classpath, jar file with no .jar extension in Weblogic over Unix

If I place a file called libA.jar in a classpath folder, and rename the old one to:

libA.ja开发者_运维百科r.old

Will the classloader load the classes?

I'm using weblogic over Solaris 8.

Thank you!

Udo


No.

If you're using Java 5 or earlier, you must explicitly name all classes and jar files to be loaded. Obviously, since the old one, libA.jar.old isn't named, it won't be loaded.

It's a bit of a different story if you're using Java 6, since concept of wildcard matching exists there.

Still, non jar files won't be loaded. Info taken from official site. Quote:

Class path entries can contain the basename wildcard character *, which is considered equivalent to specifying a list of all the files in the directory with the extension .jar or .JAR. For example, the class path entry foo/* specifies all JAR files in the directory named foo.

A classpath entry consisting simply of * expands to a list of all the jar files in the current directory. A class path entry that contains * will not match class files. To match both classes and JAR files in a single directory foo, use either foo;foo/* or foo/*;foo. The order chosen determines whether the classes and resources in foo are loaded before JAR files in foo, or vice versa.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜