Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsUsing a .jnilib file in released product
https://www.eclipse.org/forums/index.php/mv/msg/165059/522821/#msg_522821
I've got an eclipse plugin that relies on LuaJava to work. This consists of a .jar file to include with my plugin, and a native library (.jnilib) file to put in the system library location (/Library/Java/Extensions on my Mac).
When I run my plugin as an 'Eclipse Application' from within the eclipse IDE, it finds the library file and all is well. However, when I export the plugin in a release, then run the released application, it can't seem to find the jnilib file.
It seems to be finding the included .jar file fine - it successfully loads those classes, but then when it tries to execute the native code it just bombs out.
Does anyone have any hints for me? Why would the native library not be visible to my released app, but works when launched from the Eclipse IDE?
I've tried adding VM arguments to the released product:
-Djava.library.path=/Library/Java/Extensions
and also
-Djava.library.path=/Users/mattgray/blah and put the .jnilib file there as well.
I've tried putting the .jnilib file all over the place, to try to get the app to load it.
I've gone into the 'Configure Build Path' menu, and clicked on the .jar, then added a 'Native library location' to match where the .jnilib file is.
I believe I've got all 64-bit code, I've used 64 bit flags to compile the library, 64 bit Java 1.6, Mac os 10.6. Eclipse 3.5.0.
Any help appreciated. Let me know if more details are required.
]]>Matt Gray2010-03-24T03:08:59-00:00Re: Using a .jnilib file in released product
https://www.eclipse.org/forums/index.php/mv/msg/165059/523166/#msg_523166
this usually works for me:
You add a folder "lib" in your project where you store the external library jar files as well as the native libraries.
In the project properties, i.e. in the build path, you add the library jar file (in the tab "Libraries"). Additionally you set the lib folder as the "Native library location" of the specified jar file. (In the "Order and Export" tab you can also check the libraries that should be exported.)
As a second step, you have to go in the Plug-in definition (the MANIFEST.MF or plugin.xml) and to open the tab "Build". There you have to make sure that all required files/folders are checked in the "Binary Build" definitions.
By including the native libraries in your project, you don't have to take care if the end user has installed the needed libraries by himself...
I hope this solves your problem,
Martin]]>Martin D.2010-03-25T12:25:02-00:00Re: Using a .jnilib file in released product
https://www.eclipse.org/forums/index.php/mv/msg/165059/523704/#msg_523704
I guess that means building and including native libraries for all combinations of platform that you are targeting though? ]]>Matt Gray2010-03-28T22:19:51-00:00Re: Using a .jnilib file in released product
https://www.eclipse.org/forums/index.php/mv/msg/165059/523708/#msg_523708
Thanks for the suggestion anyway. ]]>Matt Gray2010-03-28T23:14:49-00:00Re: Using a .jnilib file in released product
https://www.eclipse.org/forums/index.php/mv/msg/165059/523746/#msg_523746
Quote:
I guess that means building and including native libraries for all combinations of platform that you are targeting though?
You have to add the native libraries for all platforms you are targeting into this directory. Usually these are *.dll files for Windows, *.jnilib for MacOS and lib*.so for Linux.
I am not sure but I think you also need different versions of the libs for 32bit and for 64bit systems...]]>Martin D.2010-03-29T07:17:01-00:00Re: Using a .jnilib file in released product
https://www.eclipse.org/forums/index.php/mv/msg/165059/523954/#msg_523954
Someone had forgotten to include a required file in the plugin build.
Sorted that, and now the exception has gone, and all the jnilib stuff is working.
Sorry for the noise. ]]>Matt Gray2010-03-30T01:13:58-00:00Re: Using a .jnilib file in released product
https://www.eclipse.org/forums/index.php/mv/msg/165059/524266/#msg_524266
> I worked out the problem - the issue was not with the loading of the
> jnilib, but the line above that was throwing an exception that wasn't
> getting caught.
great. Did you consider providing your LuaJava bundle/build script as open source so
others who want to integrate LuaJava with Eclipse don't need to go through the pain you
had to go through? Maybe you can convince the LuaJava project to provide an official
bundle? :)
Greetings,
Ralf
-- http://www.ralfebert.de/blog/ http://twitter.com/ralfebert/]]>Ralf Ebert2010-03-31T11:22:25-00:00Re: Using a .jnilib file in released product
https://www.eclipse.org/forums/index.php/mv/msg/165059/528666/#msg_528666
I'm having exactly the same problem as you described above. I'm trying to create a mediaplayer applet using JMF and Fobs4JMF. The applet works fine when I run it from eclipse but clearly it doesn't load the needed jnilib when it is exported to a jar file. I've tried everything you mentioned above but no luck.