• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Unable to show icons in toolbar in the applet

 
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
 
Ranch Hand
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
 
Rancher
Posts: 43011
76
  • 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.
 
I RELEASE YOU! (for now .... ) Feel free to peruse this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!