Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unable to show icons in toolbar in the applet

 
Shah Devang
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Caused by: java.security.AccessControlException: access denied (java.io.FilePermission com/accurev/jira/images/first.png read)
HowCanAnAppletReadFilesOnTheLocalFileSystem
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic