Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

where does a class come from?


  • From: rschulz@xxxxxxxxxxxxxxx (Randall R Schulz)
  • Subject: where does a class come from?
  • Date: Wed, 29 Dec 1999 16:43:19 -0800

Mitch,

My experience has shown that the presence of a .class file of the 
appropriate name (the class name, of course) in the appropriate 
subdirectory (based on the package name, of course) of the Netscape 
Java library folder will take precedence during class loading over 
one that is also present in one of the JAR files comprising the total 
available set of Java classes.

I have used this to good advantage when in earlier releases of the 
Netscape JVM there were classes that were not updated to JDK 1.1 and 
hence were missing certain methods.

I've also found that the browser does not "know" which JAR files are 
part of its distribution. Any JAR file in the Java library directory 
will be included in the implicit class search path used by the 
Netscape JVM. If I recall (I'm a bit hazy on this point), the JAR 
files are searched in alphabetical order of their names.

Otherwise, I don't believe there's any real CLASSPATH-style support 
for the Netscape embedded JVM.

I wrote a "type" (as in the BASH built-in) or "which" type program as 
a BASH script that would use the CLASSPATH to look up a .class using 
the same search algorithm as the JVM. You could use this tool by 
creating a CLASSPATH that simulated the search algorithm I outlined 
above. I wrote this script for JDK 1.1 before the "boot-classpath" 
concept was introduced, so I'd probably have to review the script and 
the boot-classpath specifications to make sure it was still working 
properly for Java 2. Unfortunately, I don't have it handy here / now. 
If you or anybody would like this script, I'd be happy to pass it 
along once I'm back in the office next week. Just let me know.

Randy Schulz
Teknowledge Corp.
Palo Alto, CA USA


At 18:22 -0500 12/29/99, Gart, Mitch wrote:
>I've got a problem with class version conflicts.  My code is
>all in a jar but a conflicting version of a class is coming
>from somewhere else, outside the jar.  I'd like to write a test
>that shows where a class is loaded from, that is, what directory
>or jar on the CLASSPATH the class comes from.  Does anybody know
>how to write a test like this?
>
>I think the problem is made a lot harder by the fact that my code
>is an applet.  The code can't be started with "java -classpath",
>instead it must use whatever classpath is set for Netscape.
>(The problem is in Netscape 4.5 on Windows 95.)
>
>It's pretty mysterious because the user has tried setting their
>CLASSPATH to be empty.  We don't know where the conflicting version
>of the class could be coming from.
>
>Any ideas how to diagnose where a class version conflict is coming
>from, in this environment?  Thanks in advance,
>
>- Mitch
>
>---
>To unsubscribe, mail advanced-java-unsubscribe@xxxxxxxxxxxxxxxx
>To get help, mail advanced-java-help@xxxxxxxxxxxxxxxx


---
To unsubscribe, mail advanced-java-unsubscribe@xxxxxxxxxxxxxxxx
To get help, mail advanced-java-help@xxxxxxxxxxxxxxxx