Advertisement
|
This page contains an archived post to the Java Answers Forum made prior to February 25, 2002.
If you wish to participate in discussions, please visit the new
Artima Forums.
Message:
Applet Problem
Posted by Ashok Gupta on July 01, 2001 at 9:10 AM
I am writing an applet which contains a TextArea. I want this applet to read text from a text file and display it in the TextArea. I created a File object using the following code : File f = new File("Text.txt"); and then went about reading and displaying text. This approach worked fine when I ran the program in appletviewer. When I tried to run the applet in Internet Explorer the text file could not be loaded. Then I changed the above code like this : File f = new File("C:/Java/Text.txt"); giving the full path name. This worked fine. But whenever I change directories I have to change the code and recompile. My question is, is there a way to specify the file so that I do not have to write the absolute path? I want to include this applet in my home page where giving the full path name would not be very convenient. Please help. Ashok
Replies:
- one more thing Pavan Kumar Keely July 02, 2001 at 7:29 AM
(0)
- one more thing Pavan Kumar Keely July 02, 2001 at 7:29 AM
(0)
- one more thing Pavan Kumar Keely July 02, 2001 at 7:23 AM
(0)
- reply Pavan Kumar Keely July 02, 2001 at 7:22 AM
(0)
- reply Pavan Kumar Keely July 02, 2001 at 7:19 AM
(1)
|