dcsimg
How do I provide access for an applet to read and write files on my system?
3 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Geetha_Srinidhi
Posted On:   Wednesday, September 5, 2001 05:17 AM

I'm loading an applet which has a Load button, which should actually bring up the Open file JFileChooser dialog box. But when I click this button, I get the following exception. Exception occurred during event dispatching: java.security.AccessControlException: access denied (java.util.PropertyPermissio n user.home read) at java.security.AccessControlContext.checkPermission(AccessControlConte xt.java:272) at java.security.AccessController.checkPermission(AccessController.java: 399) at java.lang.SecurityManager.checkPermission(SecurityManager.java:545) at java.lang.SecurityManager.checkPropertyAccess(SecurityManager.java:12 78) at java.lang.System.getProperty(System.java   More>>

I'm loading an applet which has a Load button, which should actually bring up the Open file JFileChooser dialog box. But when I click this button, I get the following exception.


Exception occurred during event dispatching:
java.security.AccessControlException: access denied (java.util.PropertyPermissio
n user.home read)
at java.security.AccessControlContext.checkPermission(AccessControlConte
xt.java:272)
at java.security.AccessController.checkPermission(AccessController.java:
399)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:545)
at java.lang.SecurityManager.checkPropertyAccess(SecurityManager.java:12
78)
at java.lang.System.getProperty(System.java:560)
at javax.swing.filechooser.FileSystemView.getHomeDirectory(FileSystemVie
w.java:110)
at javax.swing.JFileChooser.setCurrentDirectory(JFileChooser.java:443)
at javax.swing.JFileChooser. (JFileChooser.java:308)
at javax.swing.JFileChooser. (JFileChooser.java:266)
at com.hp.ArrayLogMgr.gui.logs.LoadDialog. (LoadDialog.java:36)
at com.hp.ArrayLogMgr.gui.logs.TopPanel.checkLabel(TopPanel.java:170)
at com.hp.ArrayLogMgr.gui.logs.TopPanel.actionPerformed(TopPanel.java:91
)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:14
50)
at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Abstra
ctButton.java:1504)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel
.java:378)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:250
)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonL
istener.java:216)
at java.awt.Component.processMouseEvent(Component.java:3715)
at java.awt.Component.processEvent(Component.java:3544)
at java.awt.Container.processEvent(Container.java:1164)
at java.awt.Component.dispatchEventImpl(Component.java:2593)
at java.awt.Container.dispatchEventImpl(Container.java:1213)
at java.awt.Component.dispatchEvent(Component.java:2497)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:2451
)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:2216)

at java.awt.LightweightDispatcher.dispatchEvent(Container.java:2125)
at java.awt.Container.dispatchEventImpl(Container.java:1200)
at java.awt.Component.dispatchEvent(Component.java:2497)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:339)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchTh
read.java:131)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
ad.java:98)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:85)

   <<Less

Re: How do I provide access for an applet to read and write files on my system?

Posted By:   Geetha_Srinidhi  
Posted On:   Thursday, September 6, 2001 08:06 PM

Thanks. I'll look for info on signing applets.

Re: How do I provide access for an applet to read and write files on my system?

Posted By:   John_Zukowski  
Posted On:   Thursday, September 6, 2001 12:23 PM

Signing applets so you can do this is already covered in the FAQ.

Re: How do I provide access for an applet to read and write files on my system?

Posted By:   Igor_Vinnikov  
Posted On:   Thursday, September 6, 2001 12:19 AM

Java security system don't allow you to access the file system from applets. Applets works in so-called sandbox and some operations: access to file system, network connections to another hosts and so on by default don't allow to applet. But JDK 1.1 sandbox can give permissions to perform this operations to trusted applets. Trusted applets can execute out of sandbox scope operations. In order to create trusted applet you need to generate digital certificate, create signed applet (jar-file) and correct Java security permissions.
About | Sitemap | Contact