Results 1 to 1 of 1
Thread: Opening a file
- 01-30-2011, 08:34 PM #1
Opening a fileI have a Jar file containing a class file called Loggin.class which is an applet, there is also another file called MREAManager.class
the MREAManager.class file loads a file outside of the Jar file called "lgindt.xls" the Loggin.class calls the MREAManager's constructor which then loads the File.
The file ("lgindt.xls") is at the same location as the Jar file. normally this would be ok and work, but it doesnt seem to find the file.
i created an HTML file to test the applet, the applet loads fine but doesnt load the file.
I heard i the URL class but i wasnt sure if that would work or not. if anyone has any ideas please share.
url = new URL(dir);
urlConn = url.openConnection();
dis = new DataInputStream(urlConn.getInputStream());
Next, create a URLConnection object named urlConnection by invoking url.openConnection(). Then, this connection is defined to be an input connection by invoking setDoInput() method of the URLConnection class. To make sure that we get a real copy of the data file and not a cached file, we also invoke setUsesCaches(false).
Last edited by rdjava; 01-30-2011 at 09:31 PM.
- By viperlasson in forum New To JavaReplies: 0Last Post: 09-21-2010, 07:32 AM
- By Char in forum New To JavaReplies: 15Last Post: 08-29-2010, 07:09 AM
- By Prajin in forum New To JavaReplies: 7Last Post: 08-06-2010, 07:20 AM
- By Cluster Storm in forum AWT / SwingReplies: 6Last Post: 06-07-2010, 06:03 PM
- By Raghav kv in forum New To JavaReplies: 1Last Post: 08-11-2007, 01:55 PM