This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

applet file is not working

 
Naveenzion Kumar
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi this is naveen ,
when i run my applet file through firefox in my browser window shows a Cross mark in left-top corner .and my java console shows an error .this is my error .please help me tio fix this problem

Java Plug-in 1.6.0_20
Using JRE version 1.6.0_20-b02 Java HotSpot(TM) Server VM
User home directory = /root
----------------------------------------------------
c: clear console window
f: finalize objects on finalization queue
g: garbage collect
h: display this help message
l: dump classloader list
m: print memory usage
o: trigger logging
q: hide console
r: reload policy configuration
s: dump system and deployment properties
t: dump thread list
v: dump thread stack
x: clear classloader cache
0-5: set trace level to <n>
----------------------------------------------------
java.security.AccessControlException: access denied (java.io.FilePermission fft2.jpg read)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:323)
at java.security.AccessController.checkPermission(AccessController.java:546)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
at java.lang.SecurityManager.checkRead(SecurityManager.java:871)
at sun.awt.SunToolkit.getImageFromHash(SunToolkit.java:871)
at sun.awt.SunToolkit.getImage(SunToolkit.java:885)
at javax.swing.ImageIcon.<init>(ImageIcon.java:110)
at javax.swing.ImageIcon.<init>(ImageIcon.java:136)
at applet.init(applet.java:383)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Plugin2Manager.java:1579)
at java.lang.Thread.run(Thread.java:619)
Exception: java.security.AccessControlException: access denied (java.io.FilePermission fft2.jpg read)
java.security.AccessControlException: access denied (java.io.FilePermission fft2.jpg read)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:323)
at java.security.AccessController.checkPermission(AccessController.java:546)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
at java.lang.SecurityManager.checkRead(SecurityManager.java:871)
at sun.awt.SunToolkit.getImageFromHash(SunToolkit.java:871)
at sun.awt.SunToolkit.getImage(SunToolkit.java:885)
at javax.swing.ImageIcon.<init>(ImageIcon.java:110)
at javax.swing.ImageIcon.<init>(ImageIcon.java:136)
at applet.init(applet.java:40)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Plugin2Manager.java:1579)
at java.lang.Thread.run(Thread.java:619)
Exception: java.security.AccessControlException: access denied (java.io.FilePermission fft2.jpg read)
java.lang.NullPointerException
at applet.start(applet.java:103)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Plugin2Manager.java:1639)
at java.lang.Thread.run(Thread.java:619)
Exception: java.lang.NullPointerException
 
Lester Burnham
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Apparently you're using one of the ImageIcon constructors that accesses the file system - that won't work in an applet, because the client-side file system is not under the applet's control (and not even generally accessible unless you take special steps).

Assuming that the image you want to access resides somewhere on the server where the applet is served from, you can use one of the constructors that take an URL parameter.
 
Naveenzion Kumar
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lester Burnham wrote:Apparently you're using one of the ImageIcon constructors that accesses the file system - that won't work in an applet, because the client-side file system is not under the applet's control (and not even generally accessible unless you take special steps).

Assuming that the image you want to access resides somewhere on the server where the applet is served from, you can use one of the constructors that take an URL parameter.




Thanks a lot my code is working now i followed your constructors that take an URL parameter.Thank you very much
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic