Skip to main content
GameDev.net gamedev.net
🔒 Locked 🤖 Godot

Need help converting java application to applet

Started by mslatf Nov 9, 2009 at 2:03 PM 0 replies 900+ views
Original Post
mslatf
mslatf
ok im trying to convert my java application to an applet so I just changed the JFrame to Japplet it worked fine in the applet viewer but in the browser it gave an exception : java.lang.reflect.InvocationTargetException at com.sun.deploy.util.DeployAWTUtil.invokeAndWait(Unknown Source) at sun.plugin2.applet.Plugin2Manager.runOnEDT(Unknown Source) at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source) at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: java.security.AccessControlException: access denied (java.io.FilePermission 1.jpg 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.(Unknown Source) at javax.swing.ImageIcon.(Unknown Source) at Picture.(Picture.java:6) at appleter.(appleter.java:66) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) etc The problem is sometimes it randomly works and other times it doesnt, when im rarely changing the code. Edit: I realized the exception occurs at the point when i use an external image in this specific line: ImageIcon I=new ImageIcon("1.jpg"); if so how do i insert images in applets?
Adam_42
Adam_42
Take a look at http://journals.ecs.soton.ac.uk/java/tutorial/ui/drawing/loadingImages.html

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.