aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes unexpected exception:please help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "unexpected exception:please help" Watch "unexpected exception:please help" New topic
Author

unexpected exception:please help

Nidhi Nagre
Ranch Hand

Joined: Nov 05, 2007
Posts: 64
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

Joined: Jul 26, 2007
Posts: 10523
    
    9

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.


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: unexpected exception:please help