Any problem in computer science can be solved with another layer of indirection.
This is what JavaWIDE now does with File I/O using the following classes:
- PrintStream (when used with a File object)
- PrintWriter (when used with a File object)
- Scanner (when used with a File object)
For file input, these classes first redirect to URL input which is what applets can normally do. It this fails, then it pops up a text box saying java.io.FileNotFoundException and gives the option to enter text directly into the textbox. Once the text has been entered and the Load File button is pressed, the input is forwarded to the right place using pipes. After this, the user has the option to upload the given file to the website, which usually requires a login and password. If the file uploads successfully (the user has the appropriate level of permissions to upload text files), then the next time the program runs it will read directly from the uploaded file.
For file output, a similar mechanism is followed. A text box appears with the text of the file that is being written. Once the file has been written completely to the text box, the user has the option of uploading the file to the server, just like with the file input options.
These mechanisms make it easier for students to experiment with File I/O because they don't have to worry about erasing files or creating some automated script that really messes up their hard drive. The manual uploading of files to the server prevents this from happening. It also helps tremendously with not having to worry so much about getting the path right and finding out how to correctly specify the relative and full path.