Experto. Establecer java.library.path
Frecuentes
Visto 5,086 veces
3
como puedo configurar java.library.path
in applet using Maven? Usually we can set it by passing parameters to JVM: -Djava.library.path=path/path2
. But how I can cause applet to load native libs from java.library.path
specified by me?
PS I use 3rd-party Java lib, which uses native .dll
. So I think it useless to try preload native lib using System.loadLibrary(relativePath);
(because 3rd-party lib in any case retry to load .dll from java.library.path
and then throw UnsatisfiedLinkError
)
2 Respuestas
1
como puedo configurar
java.library.path
in applet using Maven?
AFIAU it is not necessary to specify a path so long as the native is on the run-time class-path of the app. Putting it into the root of a Jar referenced as a nativelib
in the JNLP should do that.
Respondido 28 ago 12, 14:08
0
You can set the java.library.path for Maven
this way as this is something you set when the program is run, not when it is built.
For an applet the PATH
para ventanas o LD_LIBRARY_PATH
must be set correctly before the browser starts.
Otherwise you need to use the absolute path and search for the DLL or SO yourself.
BTW: You may have security problems trying to use a shared library from an applet.
Respondido 28 ago 12, 14:08
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas java maven applet java-native-interface jnlp or haz tu propia pregunta.
hmm, it's strange, but I put
.dll
inresources
package (of maven project), so this .dll 100% inside classpath, and is located in root of the jar.. But I still getUnsatisfiedLinkError
. - Bienvenido aresolved, forget to change
<jar href...>
a<nativelib href...>
. Thanks. I hope this change not expose my .jar to some additonal restrictions? - Bienvenido a"hope this change not expose my .jar to some additonal restrictions?" Not as far as I know. Glad you got it sorted. :) - Andrew Thompson