• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

java .security .AccessControlException

 
Ranch Hand
Posts: 867
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all the ranchers
When I run the JApplet in the browser,the status bar in the browser give me java.security.AccessControlException: access denied (java.io.FilePermission i.gif read)
The first question is
Could the JApplet run on browser without putting it in server?
And
How can I cope with the problem?
thanks for your time to answer
 
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi sui,
Could the JApplet run on browser without putting it in server?
yes. u write the applet on ur machine.
prepare the HTML file.
view it on local browser.
also, the image that the JApplet is trying to get "i.gif" is where? do u have a jar file for the applet? if u have the jar file then u can put ur image in that jar file and get the iamge via getResourceAsStream() or something from the applet instead referring to the file directly via,
Image img = new Image("i.gif") u know...
regards
maulin
 
Francis Siu
Ranch Hand
Posts: 867
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi Maulin
thanks you for reply
the image that the JApplet is trying to get "i.gif" is where?
In the same folder of that html and the required class.
I do not know why I can not read the .gif file

Actually,I can run on the JBuilder but I can not run on local browser.
do u have a jar file for the applet?
No.
Do I need to make a jar file for the JApplet?
thanks for your attention
 
Francis Siu
Ranch Hand
Posts: 867
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A little bit confuse of the following


checkPermission
public void checkPermission(Permission perm)
throws AccessControlExceptionDetermines
whether the access request indicated by the specified permission should be allowed or denied, based on the security policy currently in effect, and the context in this object.
This method quietly returns if the access request is permitted, or throws a suitable AccessControlException otherwise.

Parameters:
perm - the requested permission.
Throws:
AccessControlException - if the specified permission is not permitted, based on the current security policy and the context encapsulated by this object.


Can I override the above method so that I can set the permission of the action
But I do not know the object reference of the Permission object,Can I use Permission object point to the pathname of a file?

Most Permission objects also include an "actions" list that tells the actions that are permitted for the object. For example, for a java.io.FilePermission object, the permission name is the pathname of a file (or directory), and the actions list (such as "read, write") specifies which actions are granted for the specified file (or for files in the specified directory). The actions list is optional for Permission objects, such as java.lang.RuntimePermission, that don't need such a list; you either have the named permission (such as "system.exit") or you don't.


please help me how do I need to do.
thanks
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic