try {
-
URL url = new URL( getCodeBase(), filename );
-
} catch ( MalformedURLException e ) {
-
System.err.println( "Bad URL:" + url.toString() );
-
}
-
where getCodeBase() returns the applet path. (Another method getDocumentBase() returns the path of the corresponding HTML document.)
-
Next, open a stream to this URL:
-
BufferedReader in =
-
new BufferedReader(
-
new InputStreamReader( url.openStream() ) );
|