My question is this: I need write an applet that have to access a file on the host server instead of local system. For example, if the applet is downloaded from www.xxx.com/lab4 , then that file also is in www.xxx.com/lab4. How can the applet connect back to its home directory to access that file?
Since the file is in the same directory as the applet, and thus publicly accessible, you can use the HttpURLConnection class to retrieve it. [ July 24, 2005: Message edited by: Ulf Dittmer ]
As Ulf says, reading the file is easy. To write to the file, you'll generally need a servlet or other server-side program to receive the data and write it to a file.