Wrox Home  
Search P2P Archive for: Go

  Return to Index  

security_java thread: Applet Security


Message #1 by Vineet Jain <vineet.jain@i...> on Tue, 09 Jul 2002 13:55:57 +0530
Hi Java Gurus

I am trying to write a java applet which will try to access the hard disk 
of the client machine so as to load a csv file in a table in the applet.
I am aware that an applet cannot access the client's hard disk without a 
proper security policy file. Such a policy file was made using the 
policytool.exe and included in the applet jar file. On trying to load the 
applet itself I was given the following error

java.security.AccessControlException: access denied 
(java.util.PropertyPermission user.home read)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPropertyAccess(Unknown Source)
at java.lang.System.getProperty(Unknown Source)
at javax.swing.filechooser.FileSystemView.getHomeDirectory(Unknown Source)
at javax.swing.JFileChooser.setCurrentDirectory(Unknown Source)
at javax.swing.JFileChooser.<init>(Unknown Source)
at javax.swing.JFileChooser.<init>(Unknown Source)
at VendorApplet.<init>(VendorApplet.java:133)
at java.lang.Class.newInstance0(Native Method)
at java.lang.Class.newInstance(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

The work around I implemented was that I created a .java.policy file using 
the policytool.exe and stored it on the client machine and then tried to 
load the applet. The applet loaded without any errors with the policy file 
on the client machine.
Is there any way we can tell applet to use the policy file included in the 
applet jar file. 

Any help would be highly appreciated

Thks & regds
Vineet

  Return to Index