|
Replies:
6
-
Last Post:
May 14, 2007 3:24 PM
by: tdanecito
|
Threads:
[
Previous
|
Next
]
|
|
|
|
|
|
Support for files outside jars
Posted:
May 2, 2007 11:08 AM
|
|
|
Hi All,
Does anyone know how to get webstart to put files outside the jar in a temp location that is related to where the jnlp starts from? I have a open source project whose code looks for files relative to the location of where the web start application starts. I discovered if I copy the files to the expected file on the desktop then everything is okay.
What I would like to do is put the files (dll's actually) in a location that can be found by the app but not visible on the dektop.
Any ideas? I figured maybe to use the user.home path and create a temp dir there then copy the dlls there for the open source code to find. Hate to put it in one users folder rather than a centralized temp folde but not sure how to go about that.
Regards, -Tony
|
|
|
|
|
|
|
Re: Support for files outside jars
Posted:
May 2, 2007 8:59 PM
in response to: tdanecito
|
|
|
The recommended way of delivering native shared libraries via JWS is to put them in the root of a jar.
Of course, if you're not loading via System.loadLibrary, you'll have to figure out the actual location, but JWS will at least download and install them for you.
Chances are you could obtain the dll path via ClassLoader.getResource.
|
|
|
|
|
|
|
|
Re: Support for files outside jars
Posted:
May 3, 2007 8:54 AM
in response to: twalljava
|
|
|
> Chances are you could obtain the dll path via > ClassLoader.getResource. I understand, that as of JDK 6, that ClassLoader.getResource will return the location on the site from which the resource was obtained and not the location on your machine.
|
|
|
|
|
|
|
|
Re: Support for files outside jars
Posted:
May 3, 2007 5:40 AM
in response to: tdanecito
|
|
|
Hi,
It is possible to load a dll using the nativelib tag in JNLP file as mentioned in the Java Web Start FAQ: http://java.sun.com/javase/6/docs/technotes/guides/javaws/developersguide/faq.html#210. With this kind of deployment the dll is located in Java Web Start cache and is not visible in the desktop. Then use System.loadLibrary() with the library name without .dll extension. If you are not the owner of the code loading the library and cannot make it work the proper way, consider using System.setProperty("java.library.path", "apath") to set the path where dlls are located.
Reagards,
Laurent.
|
|
|
|
|
|
|
|
Re: Support for files outside jars
Posted:
May 3, 2007 7:56 AM
in response to: sauvage
|
|
|
Like Laurent said...
Here's a sample snippet from a JNLP file that uses JDIC components that requires native libs:
<resources os="Windows">
<jar href="jdic.jar" version="0.5.1"/>
<nativelib href="jdic-native.jar" version="0.5.1"/>
</resources>
Erik
|
|
|
|
|
|
|
|
Re: Support for files outside jars
Posted:
May 14, 2007 3:24 PM
in response to: tdanecito
|
|
|
Thanks everyone,
I ended up writing code to extract the dlls and put them in a specific directory where the dll's could locate themselves. I know quite well the native lib mechanism for dlls but this was a different case where the main dll wanted the absolute location of the others for dynamic linking.
So I am running fine now. Thanks, -Tony
|
|
|
|
|