• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

unexpected exception:please help

 
Nidhi Nagre
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi friends,

actually, i am trying to send and image from japplet that is embedded in jsp, to a servlet. now after running jsp page I tried to read the image file from my local hard drive using code inside embedded japplet class. and i got the following exception in sun java console, however If i am running japplet without jsp then every thing is working fine.

if someone got this exception ever then please let me know how to fix it.

[code]
java.security.AccessControlException: access denied (java.io.FilePermission F:\wallpapers\NATURE26.JPG read)
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.checkRead(Unknown Source)
at java.io.File.canRead(Unknown Source)
at javax.imageio.ImageIO.read(Unknown Source)
at Send_data.create_send_get_Image(Send_data.java:135)
at Send_data$2.mouseClicked(Send_data.java:78)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

[code]


tnanks in advance!
 
Maneesh Godbole
Saloon Keeper
Posts: 11096
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Nidhi Nagre:

[code]
java.security.AccessControlException: access denied (java.io.FilePermission F:\wallpapers\NATURE26.JPG read)
at java.security.AccessControlContext.checkPermission(Unknown Source)
[code]




Nothing unexpected about it. Applets by default are not allowed to access any system resources, in your case F:\wallpapers\NATURE26.JPG.
You will need to provide a policy file which will define the permissions.
For more on policy files take a look at this artile.
Best of luck.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic