Hey guys,
Here is the thing : I have an applet built with jMonkey and this applet would allow the client to connect to a server. The server would load some file on its hard disk and if this file doesn’t exists, the server writes some stuff in a new file and saves it on the hard disk).
For the moment, I don’t have any server set, so I run the server side of the game on the client, which means that I make the client listen to the 127.0.0.1 host and that if the server wants to save a file, he saves it where the java app is called from, right ?
Now, when I visit my applet page, nothing appears. The Java console gives me this :
[java]Exception in thread “Thread-16” java.security.AccessControlException: access denied (“java.net.SocketPermission” “127.0.0.1:4856” “connect,resolve”)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at sun.awt.AWTSecurityManager.checkPermission(AWTSecurityManager.java:959)
at java.lang.SecurityManager.checkConnect(Unknown Source)
at sun.plugin2.applet.SecurityManagerHelper.checkConnectHelper(Unknown Source)
at sun.plugin2.applet.AWTAppletSecurityManager.checkConnect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at com.test.testproject.network.Client.tick(Client.java:133)
at com.test.testproject.network.ClientThread.run(Client.java:230)
Exception in thread “LWJGL Renderer Thread” java.security.AccessControlException: access denied (“java.io.FilePermission” “savedgame1” “read”)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at sun.awt.AWTSecurityManager.checkPermission(AWTSecurityManager.java:959)
at java.lang.SecurityManager.checkRead(Unknown Source)
at java.io.File.exists(Unknown Source)
at com.test.testproject.Engine.loadSavedWorld(Engine.java:494)
at com.test.testproject.Engine.simpleInitApp(Engine.java:196)
at com.test.testproject.Engine.simpleInitApp(Engine.java:239)
at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:228)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:129)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:205)
at java.lang.Thread.run(Unknown Source)[/java]
If I got it right, I have two problems here : the applet won’t allow to connect to the local loop and something is wrong when reading a saved file.
So my question is simple : how to solve these two problems ? I guess I forgot something for the first problem. Maybe something with passing some parameters in the applet to allow it to communicate.
For the second problem, it’s more tricky. If I run my game directly from the IDE, the files are saved withtout problems in the directory where I saved my whole project. I guess If I launch my project via an applet, the file would be saved where the cache data downloaded by java are stored: some directory inside another system directory. So, why can’t I save a file to this directory ?
Thanks for the help, guys.