So I have no clue how to fix this.
The problem is that I have this applet, which has canvas. I use that canvas as a parent to LWJGL's display. It works perfectly when I run it as applet in eclipse. When I create a jar file and put it into a html file and try to run the web page, the applet works like shit.
When I run in eclipse, it works like it should. Canvas's addnotify method is called, then start method is called. Once I close the applet, stop method is called and removenotify afterwards.
When I try to run it in web page, addnotify is called, then start, and removenotify once I start the page. I don't close it or anything, it just gets called right after start method.
I have no idea why this happens. Any help would be awesome.
Here is the html code:
<applet code="com.chrisindiegames.game.GameApplet.class" archive="game.jar" width="800" height="600">
After long frustrating hours I seem to have found the problem. No idea how I found it, but here is the exception.
Exception in thread "Thread-46" java.security.AccessControlException: access denied ("java.util.PropertyPermission" "user.dir" "read")
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at sun.plugin2.applet.AWTAppletSecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPropertyAccess(Unknown Source)
at java.lang.System.getProperty(Unknown Source)
at java.io.Win32FileSystem.getUserPath(Unknown Source)
at java.io.Win32FileSystem.resolve(Unknown Source)
at java.io.File.getAbsolutePath(Unknown Source)
The problem seems to be with permissions, access rights or something like that. Does anyone know how to fix this? To be exact, here is the line that the error occurs:
File f = new File("nat");
String path = f.getAbsolutePath();