Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
where does a class come from?
- From: mgart@xxxxxxxxxxxxx (Gart, Mitch)
- Subject: where does a class come from?
- Date: Thu, 30 Dec 1999 06:38:28 -0500
I've done some research and haven't yet found the answer to my problem
but have found some pretty interesting stuff. Thought I'd share it with
the list. I wrote a little applet that displays its classpath in a
TextArea. This turns out to be non-trivial because reading the
classpath is a privileged operation so the applet has to be signed,
and has to call netscape.security to get permission to
read the classpath. The applet's source is included below.
The applet's classpath when running (Netscape 4.61 on Windows NT) is:
java.class.path=
D:\Program Files\Netscape\Communicator4.61\Program\java\classes\ifc11.jar
D:\Program Files\Netscape\Communicator4.61\Program\java\classes\iiop10.jar
(and other .jar and .zip files in this directory, in alphabetical order)
c:\xxx
c:\yyy
(these are things I put on my system classpath, in control panel)
D:\Program Files\Netscape\Communicator4.61\Program\java\classes
D:\Program Files\Netscape\Communicator4.61\Program\java\download
D:\Program Files\Netscape\Communicator4.61\Program\plugins\cpPack1.jar
(and other .jar and .zip files in this directory, in alphabetical order)
D:\Program Files\Netscape\Communicator4.61\Program\plugins
I think the culprit that's causing the classpath conflict might be in
the download directory, but I'll have to check it out some more.
This is pretty interesting. In all these years of working with Java
and (sometimes) applets I've never known just where the classes get
loaded from. Now we know. Wish Netscape had documented this.
Here's the source of my little applet. It has to be signed to work.
- Mitch
import java.applet.*;
import java.awt.*;
import java.util.Properties;
import netscape.security.*;
public class prop5 extends Applet {
private TextArea area = new TextArea(
"", 10, 80, TextArea.SCROLLBARS_VERTICAL_ONLY);
private void add(String s) { area.append(s); }
private void addLine(String s) { add(s + "\n"); }
private void getProp(String propName) {
try {
PrivilegeManager.enablePrivilege("UniversalPropertyRead");
add(propName);
add("=");
add(System.getProperty(propName));
} catch (Exception e) {
add("exception " + e);
}
add("\n");
}
public void init () {
add(BorderLayout.CENTER, area);
addLine("codebase = " + getCodeBase());
getProp("java.class.path");
}
}
---
To unsubscribe, mail advanced-java-unsubscribe@xxxxxxxxxxxxxxxx
To get help, mail advanced-java-help@xxxxxxxxxxxxxxxx
- Prev by Date: Design Issue
- Next by Date: Arguments for using Java in the Enterprise
- Previous by thread: where does a class come from?
- Next by thread: Re[2]: where does a class come from?
- Index(es):