I have a signed applet that loads the native libraries to the applet client machine(java library path, C:\Program Files\Java\jre6\bin). When i have admin rights on the client machine, it copies the dll files without any issue. But when i dont have admin rights, the applet failed to copy the files in the location C:\Program Files\Java\jre6\bin. Is it possible for a singed applet to load the dll files on the java libaray path when the enduser executing the applet dont have admin rights?.
I thought the singed applet will do anything as it is trusted regardless of the admin rights. Please clarify me.
I have a third party jar that actually looks for the DLL file in the location C:\Program Files\Java\jre6\bin and performs some action. So my applet basically loads the DLL files into that location. The DLL files are placed inside the applet jar file and the applet jar is signed. I have also singed the third party jars.
The applet copies the DLL file if the enduser running the applet(applet is embedded in the webapplication) had the adminstrative rights on that directory. Else it does not cpy it gives the error:
java.io.FileNotFoundException: C:\Program Files\Java\jre6\bin\SigUsb.dll(Access is denied)
nithya lakshmi wrote:I have a third party jar that actually looks for the DLL file in the location C:\Program Files\Java\jre6\bin
Then you're the victim of bad software. (Hard-coding. Bad. Don't do that.) My recommendation would be to get that problem fixed. If you can't, then perhaps you're going to have to ask the users of your applet to make sure they are signed on as an administrator when they run it.
Joined: Feb 25, 2010
Thanks for the reply,
I could able to copy the the DLLs to the temporary location for each and every user (java.io.tmpdir) and then set the java.libarary.path pointing to java.io.tmpdir.
In this way i can download the DLLs from the applet and then use it. Do you think is this the good approach to follow?.
Joined: Mar 22, 2005
Do you think is this the good approach to follow?.
Absolutely not. You should not mess with the client machine unless necessary, and in this case it's not necessary. You can easily package the DLL file(s) as jar files, sign those, and ship them along with the applet jars - no need to copy files around at all - that's a much better approach. A helper class like JNLPAppletLauncher makes this a snap to use.