• 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
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

how to load image from a subdirectory on server

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi frnds,
please help me with this. I am trying to display an image on the applet. the image resides in the "images/listBackgr.gif" directory on the server and the applet is placed on the root path. with i try to access the image from the Applet using the code following i get an error.
JLabel imgTry = new JLabel();
imgTry.setIcon(new ImageIcon(getCodeBase() + "/images/listBackgr.gif"));

The Error is......

java.security.AccessControlException: access denied (java.io.FilePermission http://localhost/envoy_ws_new/Live/EN//images/listBackgr.gif read)
at java.security.AccessControlContext.checkPermission(AccessControlConte
xt.java:270)
at java.security.AccessController.checkPermission(AccessController.java:
401)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:542)
at java.lang.SecurityManager.checkRead(SecurityManager.java:887)
at sun.awt.SunToolkit.getImageFromHash(SunToolkit.java:486)
at sun.awt.SunToolkit.getImage(SunToolkit.java:500)
at javax.swing.ImageIcon.<init>(ImageIcon.java:81)
at javax.swing.ImageIcon.<init>(ImageIcon.java:107)
at ClassMatrix1.init(ClassMatrix1.java:143)
at sun.applet.AppletPanel.run(AppletPanel.java:348)
at java.lang.Thread.run(Thread.java:536)

could someone help me sort this problem out.....will i have to sign the applet???... or can i just solve it by making changes in the code.
Quick response is appriciated.
Thanx in advance.
Masky.
 
Evacuate the building! Here, take this tiny ad with you:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic