File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Applets and the fly likes Unable to show icons in toolbar in the applet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "Unable to show icons in toolbar in the applet" Watch "Unable to show icons in toolbar in the applet" New topic
Author

Unable to show icons in toolbar in the applet

Shah Devang
Greenhorn

Joined: Jul 27, 2006
Posts: 12
Hi,

In my applet jar, I have added the images that I want to show on the toolbar. In the init() function of the applet, I create the button and set the image, however, in the Java Console of the browser I get the following error message :

ava.lang.ExceptionInInitializerError

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.applet.AppletPanel.createApplet(Unknown Source)

at sun.plugin.AppletViewer.createApplet(Unknown Source)

at sun.applet.AppletPanel.runLoader(Unknown Source)

at sun.applet.AppletPanel.run(Unknown Source)

at java.lang.Thread.run(Unknown Source)

Caused by: java.security.AccessControlException: access denied (java.io.FilePermission com/accurev/jira/images/first.png 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 sun.awt.SunToolkit.getImageFromHash(Unknown Source)

at sun.awt.SunToolkit.getImage(Unknown Source)

at javax.swing.ImageIcon.<init>(Unknown Source)

at javax.swing.ImageIcon.<init>(Unknown Source)

at com.accurev.jira.diffview.DiffApplet.<clinit>(DiffApplet.java:28)

... 11 more


Can anyone please help me out ?
What all I need to do in order to access the images that are in the applet jar.

Thanks
Devang Shah
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
Caused by: java.security.AccessControlException: access denied (java.io.FilePermission com/accurev/jira/images/first.png read)
HowCanAnAppletReadFilesOnTheLocalFileSystem
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41108
    
  45
The image is in the applet jar file. correct? If so, you can't access it using the file.io package - you need to treat them as resources and access it through the classloader. Some hints on how to do this can be found here.


Ping & DNS - my free Android networking tools app
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Unable to show icons in toolbar in the applet
 
Similar Threads
Applet problems
Buttons with imagens in applet from server
Security Exception for showing images
AccessControlException and DefClassNotFound
custom classloader in applet