Reputation: 199
For my JNLP file , there is some nativelib info like below:
<resources os="Windows">
<nativelib href="lib/x264-win.jar" />
</resources>
<resources os="SunOS" arch="sparc">
<nativelib href="lib/x264-SunOS-sparc.jar" />
</resources>
<resources os="SunOS" arch="x86">
<nativelib href="lib/x264-SunOS-x86.jar" />
</resources>
When I Update To JRE7, can not load nativelib jar, but JRE6 works fine.
The load nativelib code like below:
String source = "x264.jar";
ClassLoader cl = Thread.currentThread().getContextClassLoader();
URL url= cl.getResource(source);
"x264.jar" is one jar in x264-win.jar,lib/x264-SunOS-sparc.jar or lib/x264-SunOS-x86.jar.
When I used JRE6 to load x264.jar, it worked fine. But when I updated to JRE7, it can not load x264.jar.
When use JRE6, url would be"x264.jar" info, like jar:http://test.local:8080/JNLP.jar!/x264.jar, but use JRE7, url would be null, and I found code not load nativelib "x264.jar"
Does any one have find JRE7 can not load nativelib.jar? Is the problem of using Thread.currentThread().getContextClassLoader() to load "x264.jar"?
Upvotes: 19
Views: 1005
Reputation: 366
I had forgot I solved this a while ago. I found that I had to handle this in Java code with System.loadLibrary( "jarNameNoExtension" );
Hopefully that helps others.
Upvotes: 0
Reputation: 9816
The following "dll relying" applet is working fine (besides the security problems when using 1.7.0_51 (you need to decrease the security settings to medium since it is self signed)). So if the native lib loading mechanism of the jnlp file is broken then you can distribute your .dll files alongside a normal jar file like in the upper example.
System.load(libFolderPath + fileSeparator + libName);
like used here. Upvotes: 0
Reputation: 311
Ensure that you have the correct bitwise native binary to match your JRE. If you are testing on a 64-bit JRE, you need a 64-bit native binary. If you're testing on a 32-bit JRE, you need a 32-bit native binary. You might need to include resources for each of these three:
<resources os="Windows" arch="amd64">
<resources os="Windows" arch="x86_64">
<resources os="Windows" arch="x86">
Upvotes: 1
Reputation: 19
I had similar trouble ; however even in JRE 6 this didn't get this to work.
Found a bug that could be related to that :
https://bugs.java.com/bugdatabase/view_bug?bug_id=6758884
Apparently JRE can have trouble downloading nativelib resources.
The bug is still opened, and targeted towards version 8 of java ...
Upvotes: 0