about applet

Hi all.

A little question: I know that an applet can't read and write

files on pc but an applet can read a file on a server?

I have this statements:

( fileNameParam = //WEBGNI/pc_Pignotti/psj.rtf )

JTextPane1.setContentType("text/rtf");

try {

java.net.URL url = new

java.net.URL("file",null,fileNameParam);

JTextPane1.setPage(url);

}

catch (Exception e) {

System.out.println("Exception reading URL: " +

e.getMessage());

}

In kawa it works but with netscape I have this message from java console

:

Exception reading URL: access denied (java.io.FilePermission

\\WEBGNI\pc_Pignotti\psj.rtf read)

If otherwise i change the statement so:

java.net.URL url = new java.net.URL(fileNameParam);

I have this message :

Exception reading Url : no protocol : //webgni/pc_pignotti/psj.rtf

Where is the proble?

Thanks

[976 byte] By [miziop] at [2007-9-26 2:30:26]
# 1

Hi,

The applet cannot write or delete a file because of security reasons. For that you have to create a policy file with the help of policy tool command.

For creating a policy file and running an applet with the help of policy file is given in a good way in this URL.

http://web2.java.sun.com/docs/books/tutorial/security1.2/tour1/index.html

I hope this will help you.

Thanks

Bakrudeen

bakrudeen_indts at 2007-6-29 9:49:17 > top of Java-index,Security,Other Security APIs, Tools, and Issues...
# 2
HelloAfter creating a policy file I found the following information useful: http://www.esus.com/javaindex/j2se/jdk1.2/javaxswing/toplevelcontainers/japplet/jappletsec/signjappcontrol.htmlHope this helpsStuart
RSM45 at 2007-6-29 9:49:17 > top of Java-index,Security,Other Security APIs, Tools, and Issues...