aspose file tools*
The moose likes Applets and the fly likes applet file is not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "applet file is not working " Watch "applet file is not working " New topic
Author

applet file is not working

Naveenzion Kumar
Greenhorn

Joined: Aug 02, 2010
Posts: 24
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

Joined: Oct 14, 2008
Posts: 1337
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

Joined: Aug 02, 2010
Posts: 24
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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: applet file is not working