Netscape wont show my applet

Can anyone help? I cannot run the applet I have written in netscape. The applet reads data from a text file, parses it and prints out results on a graph. It works fine in Internet Explorer 5.5 but refuses to show in Nescape Navigator 4.7 when I see the following exception in the Java console. I include the code for the init() method below and fot the other method mentioned in the exception, parseTextDataBase() in case you need to read it(Important bits inbold. If anyone has any ideas otr a solution I'd be grateful. Thanks, .....John Loughran, Ireland

Applet::init()// a SOP that tells me init() was reached

netscape.security.AppletSecurityException: security.class from local disk trying to access url: file:/C|/Documents and Settings/jloughran/My Documents/webApplet/SimRecDataBase960.txt

at java.lang.Throwable.<init>(Compiled Code)

at java.lang.Exception.<init>(Compiled Code)

at java.lang.RuntimeException.<init>(Compiled Code)

at java.lang.SecurityException.<init>(Compiled Code)

at netscape.security.AppletSecurityException.<init>

(Compiled Code)

at netscape.security.AppletSecurityException.<init>(Compiled Code)

at netscape.security.AppletSecurity.checkURLConnect(Compiled Code)

at java.lang.SecurityManager.checkURLConnect(Compiled Code)

at netscape.net.URLConnection.connect(Compiled Code)

at netscape.net.URLConnection.getInputStream(Compiled Code)

at java.net.URL.openStream(Compiled Code)

at SimRec.parseTextDataBase(Compiled Code)

at WebApplet.init(Compiled Code)

at Netscape.applet.DerivedAppletFrame$InitAppletEvent

.dispatch(Compiled Code)

at java.awt.EventDispatchThread$EventPump

.dispatchEvents(Compiled Code)

at java.awt.EventDispatchThread.run(Compiled Code)

at netscape.applet.DerivedAppletFrame$AppletEvent

DispatchThread.run(Compiled Code)

public void init()

{

mayPrintln("Applet::init()"); // calls System.out.println

// Background and fonts code not shown

try {

aEPAppletURL = new URL(getCodeBase(), "SimRecDataBase960.txt");

//} catch (MalformedURLException mue) {

} catch (Exception mue) {

mayPrintln("Bad URL");

}

/* parse the text file into a vector of recordV's */

allSimRecsV = aSimRec.parseTextDataBase();

/** Configure componenents in topLPaneland then other ones */

configureTopLeftComponents();

/* note and count choice items from the recordsV for choice 1 */

choiceItemsVA[1] = SimRec.noteChoiceItems(choiceNo[1], choiceNoS[0], allSimRecsV);

// add choice1Items to the display

for (int i = 0; i < choiceItemsVA[1].size(); i++)

{

serverPlatformOSChoice.addItem(choiceItemsVA[1].elementAt(i).toString());

}

//mayPrintln("After configureTopLeftComponents: choice = "+ serverPlatformOSChoice.getSelectedIndex());

configureButtons();// contains controls for starting, stopping and clearing graph configureOtherComponents();

placeComponents();

/** Start the graph */

currentGraph.startGraphLayout();

currentGraph.startThread();// starts the graph thread1 running

} // ends init()

In case you are still awake I include the code for aSimRec.parseTextDataBase()

public VectorparseTextDataBase()

{

// locate the file at an absolute URL, then read it in

try {

aEPAppletURL = WebApplet.aEPAppletURL;

SimRecDBBufReader = new BufferedReader

(new InputStreamReader(aEPAppletURL.openStream()));

}

catch (FileNotFoundException fnfe) { // if file not found

WebApplet.mayPrintln("FileNotFound");

}

catch (IOException e) { // if error in reading URL

WebApplet.mayPrintln("Error reading simulation records TextDataBase or URL");

}

// start parsing text database file

boolean eof = false;

try

{// read first line

dBLine = SimRecDBBufReader.readLine(); // goes to first line of file

if (dBLine == null)

eof = true;

while (eof == false)

{

tempRecordV = null; // leave it empty for next iteration

Vector tempRecordV = new Vector();

dBLine = dBLine.trim(); /** Removes white space from both ends of this string */

dBLineLength = dBLine.length ();

if(dBLine.startsWith (comment)); // do 0

else if(dBLine.equals("")); // do 0

else

{

// note the first and last character index of each field, store the substring as a field

beginIndex = 0; // index of char at start of each "field"

while (beginIndex < dBLineLength)

{

endIndex = beginIndex; // both 0 initially

while (dBLine.charAt(endIndex) != delimiter

&& endIndex < dBLineLength - 1)

{

endIndex++;

//i++;

}

fieldString = dBLine.substring(beginIndex, endIndex);

tempRecordV.addElement(fieldString); // adds the field string to the record vector

// jumps while loop forward in chunks to maintain linear complexity

beginIndex = endIndex + 1; // brings bI to just after the next delimiter

} // end while bI < line length

simRecordsV.addElement(tempRecordV);

} // end else

dBLine = SimRecDBBufReader.readLine(); // goes to next line of file

if (dBLine == null)

eof = true;

} // end while not eof

} //end try

catch (EOFException eofe) { // if file ends

eof = true;

WebApplet.mayPrintln("End of file reached unexpectedly");

} catch (IOException iof) {

eof = true;

WebApplet.mayPrintln("I/O exception");

}

WebApplet.mayPrintln("all sim recs read in");

return simRecordsV;

} // end parseTextDataBase()

Thanks for any help in advance. :-)

John

[5935 byte] By [JohnLoughran] at [2007-9-26 4:36:17]
# 1

You are trying to read a local file from an applet. That is normally not allowed, because then you could have an applet on a webpage and when someone uses your applet you would get access to his files.

There might be ways to get around this, but the user has to grant you the permissions.

abnormal at 2007-6-29 17:54:04 > top of Java-index,Desktop,Core GUI APIs...
# 2
Hi !You could try this:URL fileURL;Class cl = ((JApplet) this).getClass(); fileURL = cl.getResource("/SimRecDataBase960.txt"); Hope it helps...let me know.
qdasson at 2007-6-29 17:54:04 > top of Java-index,Desktop,Core GUI APIs...