I put together a basic applet in which the user selects a file from his hard drive, he reads the first line of this file and passes it to JavaScript for some additional preprocessing, and then when you click the button, it tries to download this file via HTTP POST- request. I found a very simple open source applet for downloading files that I copied and changed for this last bit.
The problem is that it does not work. It seems to work fine, but then I run into two permission issues. Messages in the Java console say that the applet had access to failures in the following two resolutions:
java.lang.RuntimePermission setFactory
java.io.FilePermission read
I find this strange because I thought I granted permission to the applets already when I built it using the "self-signed" option noted in NetBeans and then clicked to confirm a small security popup in the browser.
Also, the part that I encoded myself, where it reads the file and passes the first line to JavaScript, works fine. This is a pretty clear indicator that the applet can read from the local file system! The problem does not start until I try to start the download. One point, I suppose, is that the boot process seems to be starting in a new thread, while everything else works in the main class without creating threads.
I am a complete newbie in Java and know little about threads in Java; Do I need to somehow transfer permissions to this new thread? Or something like that? Thanks in advance.
source
share