The Artima Developer Community
Sponsored Link

Java Answers Forum
Avoiding this error

1 reply on 1 page. Most recent reply: Apr 21, 2003 11:43 PM by Rahul

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
priti borse

Posts: 1
Nickname: prit308
Registered: Apr, 2003

Avoiding this error Posted: Apr 21, 2003 11:13 AM
Reply to this message Reply
Advertisement
I am getting this error while running applet with a thread:
ava.security.AccessControlException: access denied (java.io.FilePermission \class.class read)
at java.security.AccessControlContext.checkPermission(AccessControlConte xt.java:270)
at java.security.AccessController.checkPermission(AccessController.java: 401)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:542)
at java.lang.SecurityManager.checkRead(SecurityManager.java:887)
at java.io.File.isDirectory(File.java:698)
at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection
.java:65)
at sun.net.www.protocol.file.FileURLConnection.initializeHeaders(FileURL
Connectio n.java:90)
at sun.net.www.protocol.file.FileURLConnection.getContentLength(FileURLC
onnection .java:136)
at sun.applet.AppletClassLoader.getBytes(AppletClassLoader.java:255)
at sun.applet.AppletClassLoader.access$100(AppletClassLoader.java:42)
at sun.applet.AppletClassLoader$1.run(AppletClassLoader.java:143)
at java.security.AccessController.doPrivileged(Native Method)
at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:140)
at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
at sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:114)
at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
at sun.applet.AppletClassLoader.loadCode(AppletClassLoader.java:506)
at sun.applet.AppletPanel.createApplet(AppletPanel.java:566)
at sun.applet.AppletPanel.runLoader(AppletPanel.java:495)
at sun.applet.AppletPanel.run(AppletPanel.java:292)
at java.lang.Thread.run(Thread.java:536)


Rahul

Posts: 52
Nickname: wildhorse
Registered: Oct, 2002

Re: Avoiding this error Posted: Apr 21, 2003 11:43 PM
Reply to this message Reply
Applets generally do not have permission to read/write files on the local m/c unless approved by the security manager(for applets loaded from the network).

You can implement the SecurityManager class and override the checkRead() and checkWrite() methods for file access.

Flat View: This topic has 1 reply on 1 page
Topic: Java Byte Code Previous Topic   Next Topic Topic: Need a method for JScrollPane

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use