The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
June 2001



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.


one more thing

Posted by Pavan Kumar Keely on July 02, 2001 at 7:29 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

Have you signed your applet.....?????


Sponsored Links

Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us