I’m about to publish a web-version of my LD game, and when I got everything setup, an AccessControlException took place.
Here’s what it looked like.
Any help?
I’m about to publish a web-version of my LD game, and when I got everything setup, an AccessControlException took place.
Here’s what it looked like.
Any help?
Where are you trying to load from?
Are you using a URL or File address?
Applets can only load from the same directory/web address where they are located, I think, unless you go through some special routines and permissions for accessing areas of the host computer.
URLs work better than File addressing if any of the resources are within a jar.
File address.
Here’s the code, actually.
<applet code="net.kemoy.tmine.Game" archive="10Mine.jar" width="800" height="600">
</applet>
Everything is in the same directory.
Why do you want to open a file from the local filesystem if it is an applet?
I think you want to load the resource from the same jar which encloses your applet. You can do what you are doing by signing your applet but I don’t think that is what you mean to do.
Can you post the code which throws the exception (I.e, where you are attempting to access files from the local filesystem) and then describe your intended purpose?
Read this: http://docs.oracle.com/javase/tutorial/deployment/applet/security.html
Applets run in a ‘sandbox’ so that they can’t cause too much damage unless there’s a security problem with the java base code. If you could access the local filesystem from an applet it would be like downloading an .exe every time you used something embedded in a webpage. The alternative isn’t too bad; like Jeremy said, pack it in the .jar or store it online.