tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Wentzel <Michael.Went...@aswethink.com>
Subject RE: Clarification
Date Fri, 12 Jan 2001 16:02:45 GMT
> Sorry I should have been clearer. My example meant the 
> default package, and
> the question was in relation to what would
> happen if classes/packages were the same.
> 
> ie 
> WEB-INF/lib/a.jar
> contains;
>   org.apache.C
> 
> WEB-INF/lib/b.jar
> contains;
>   org.apache.C
> 
> Which C is loaded?

The first class in the classpath Depending on how the filesystem 
on the OS you are working on.  In other words, I believe in
windows it would end up being the a.jar class that is loaded.

The reasoning behind this is found in the following:

javac -classpath .\Classes\A.jar;..\OptClasses\A.jar Something.java

The .\Classes\A.jar class are actually loaded by the classloader
and the OptClasses\A.jar ones are essentially ignored.

I imagine in most cases, Unix flavors included, it would be a.jar that
gets loaded into the class namespace.

An easy way to test this is create two jars(a.jar and b.jar) with the 
same class but the two classes differ in a System.out.println call and 
then create an instance of that class and see which println you get.

Please correct me if I'm wrong anyone?


---
Michael Wentzel
Software Developer
<A HREF="http://www.aswethink.com">Software As We Think</A>
<A HREF="mailto://wentzel@aswethink.com">Michael Wentzel</A>

Mime
View raw message