Hi. I have an applet which accesses several local notepad.txt files. They are all on the same logical volumn and directory i.e. the html, the applet and the notepad.txt files. The question is : do I really need a signed applet to access the text files, seeing how they are all in the same directory? There has been contradictory answers, from "yes" to "no" to somewhere in between "You should always use a signed applet". Although I've a self-signed certificate for testing purposes, for simplicities' sake and to save time, I'd rather not use it until I've bought a Verisign or Thawte. So the question again: do I really need a signed applet to access local text files in the same directory as the applet and the html that launches the applet. That is to say, getCodeBase() and get DocumentBase() have same values ? Yes, I've read the online documentation and O'Reilly's "OpenSSL" , which I thoroughly recommend. I am doubting whether I really need a signed applet because I can easily access jpegs images, too easy. I can't see the exact reason why I should not be able to have my own applet read a local text file in the same directory as the applet.
Hello, By default, applets have no access to system resources outside the directory from which they were launched, but a signed applet can access local system resources as allowed by the local system's security policy. The Java Development Kit (JDK) 1.2 provides security tools so end users and system administrators can sign applets and applications, and define their local security policy by specifying in a policy file how much access to local system resources a signed applet or application can have. Well you make a sign applet it would work fine as this applet would work fine anywhere. I hope now u can go ahead. Thanks
Joined: Jul 29, 2002
Hiya, Jas. Yes, I do agree with you. I'm satisfied that an applet can access files in the same directory from which the applet and its html were launched, or, put another way, their getCodeBase() and get getDocumentBase() return same value. In the following stub code, I've omitted getDocumentBase() and hard-coded the url. It does the job: