Advanced Search

Results 1 to 2 of 2

Thread: Applet error - Access Control Exception: access denied

  1. #1
    Join Date
    Dec 2008
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Applet error - Access Control Exception: access denied

    I've put together an applet that is supposed to display a user's file system via a JTree. Unfortunately, I've been getting an access control exception error. Does anyone know how to overcome the following error?

    Java Plug-in 1.6.0_11
    Using JRE version 1.6.0_11 Java HotSpot(TM) Client VM

    java.security.AccessControlException: access denied (java.util.PropertyPermission * read,write)
    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.checkPropertiesAccess(Unknown Source)
    at java.lang.System.getProperties(Unknown Source)
    at TreeApplet.<init>(TreeApplet.java:17)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at java.lang.Class.newInstance0(Unknown Source)
    at java.lang.Class.newInstance(Unknown Source)
    at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
    at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    Exception: java.security.AccessControlException: access denied (java.util.PropertyPermission * read,write)
    Here is my code:
    Code:
    import java.applet.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.JTree.*;
    import java.util.*;
    
    
    /* 
    <applet code="TreeApplet.class" width=300 height=100>
    </applet>
     */
    
    public class TreeApplet extends Applet {
    	// Create default tree
    	Properties systemProperties = new Properties(System.getProperties());
    	JTree systemTree = new JTree(systemProperties);
    	JScrollPane scrollPane = new JScrollPane(systemTree);
    	JPanel panel = new JPanel(new FlowLayout());
    		
    	public void init(){
    		systemTree.setRootVisible(true);
    		panel.add(scrollPane);
    		setLayout(new FlowLayout());
    		add(panel);
    		setVisible(true);
    	}
    	
    	public void start(){
    		
    		showStatus("Java Tree");
    	}
    	
    	
    }
    Last edited by dan0; 02-17-2009 at 03:14 PM.

  2. #2
    Join Date
    Feb 2009
    Location
    Romania
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hello!

    http://www.wutka.com/hackingjava/ch3.htm
    You can not to have access to file system from an applet. It is a security measure.

    http://www.captain.at/programming/java/

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •