Problem regarding the JFileChooser in applets
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Atul_Kumar
Posted On:   Tuesday, April 24, 2001 06:02 AM

I have to add a JFileChooser onto one button in applets.It is throwing the excpetion AccessControlException.Can you suggest me how to resolve this problem.Although the same program is working fine as a normal appplication..As i have to design my application in such a way that it should behave like applet as well as normal application... I am creating the JFileChooser and attaching it to one browse button in a very normal way i am adding this JfileChooser... Error that is coming is as follows.... java.security.AccessControlException: access denied (java.util.PropertyPermissio n user.home read) at java.security.AccessControlContext.checkPermission(AccessControlConte xt.java:272) at java.security.A   More>>

I have to add a JFileChooser onto one button in applets.It is throwing the excpetion AccessControlException.Can you suggest me how to resolve this problem.Although the same program is working fine as a normal appplication..As i have to design my application in such a way that it should behave like applet as well as normal application...
I am creating the JFileChooser and attaching it to one browse button in a very normal way i am adding this JfileChooser...

Error that is coming is as follows....


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:109)
at javax.swing.JFileChooser.setCurrentDirectory(JFileChooser.java:443)
at javax.swing.JFileChooser. (JFileChooser.java:308)
at javax.swing.JFileChooser. (JFileChooser.java:266)
at FileChooserDemo. (FileChooserDemo.java:21)
at java.lang.Class.newInstance0(Native Method)
at java.lang.Class.newInstance(Class.java:237)
at sun.applet.AppletPanel.createApplet(AppletPanel.java:579)
at sun.applet.AppletPanel.runLoader(AppletPanel.java:515)
at sun.applet.AppletPanel.run(AppletPanel.java:293)
at java.lang.Thread.run(Thread.java:484)

   <<Less

Re: Problem regarding the JFileChooser in applets

Posted By:   kalyan_nanda  
Posted On:   Wednesday, April 25, 2001 05:04 AM

Hi
Atul
When your applet is working,its trying to access the local database. as it is looking for the entire windows explorer for the files without proior permissions.Thats why it is throwing security exception error which is quite obvious for any applet.
You can either change the policy file by making it a JAR or you can make your applet signed to make it authenticated.
About | Sitemap | Contact