Hi folks! By using the FileOutputStream class, I am able to write to a file located in the same directory as my applet. However, I am unable to read from a file as I am unable to create a URL. I cannot state something like:
as the program that I am running is not an applet, but rather a java GUI program whose methods are accessed by an applet. It extends Frame, not applet. Therefore, getCodeBase() is not recognised. Are there any other protocols that do the same thing i.e. that allow reading from a file. Regards, Sean
Joined: Jun 05, 2001
Okay; I am now able to state the following:
where SpellCheck is the name of the applet that loads the GUI. But I am still unable to state:
As this gives me an error message. Anyone know how I might work around this or suggest alternatives? Regards, Sean
This is the proper syntax: URL url = new URL(spellcheck.getCodeBase(), "words.txt"); But no matter how you spell it, or what mechanism you try, the sandbox rules still have the final say. A Java Application can write files, an applet running in the AppletView can write files, but an appplet in a web browser can only write files if it has been authorized and signed.
An IDE is no substitute for an Intelligent Developer.