Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Using a .jnilib file in released product
Using a .jnilib file in released product [message #522821] Wed, 24 March 2010 03:08 Go to next message
Matt Gray is currently offline Matt GrayFriend
Messages: 13
Registered: July 2009
Junior Member
Gday,

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.


Re: Using a .jnilib file in released product [message #523166 is a reply to message #522821] Thu, 25 March 2010 12:25 Go to previous messageGo to next message
Martin D. is currently offline Martin D.Friend
Messages: 5
Registered: March 2010
Location: Germany
Junior Member
Hi Matt,
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
Re: Using a .jnilib file in released product [message #523704 is a reply to message #523166] Sun, 28 March 2010 22:19 Go to previous messageGo to next message
Matt Gray is currently offline Matt GrayFriend
Messages: 13
Registered: July 2009
Junior Member
Thanks, I will give that a try.

I guess that means building and including native libraries for all combinations of platform that you are targeting though?
Re: Using a .jnilib file in released product [message #523708 is a reply to message #523704] Sun, 28 March 2010 23:14 Go to previous messageGo to next message
Matt Gray is currently offline Matt GrayFriend
Messages: 13
Registered: July 2009
Junior Member
Nope, not even including the jnilib in the plugin has convinced it to work.

Thanks for the suggestion anyway.
Re: Using a .jnilib file in released product [message #523746 is a reply to message #523704] Mon, 29 March 2010 07:17 Go to previous messageGo to next message
Martin D. is currently offline Martin D.Friend
Messages: 5
Registered: March 2010
Location: Germany
Junior Member
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...
Re: Using a .jnilib file in released product [message #523954 is a reply to message #523746] Tue, 30 March 2010 01:13 Go to previous messageGo to next message
Matt Gray is currently offline Matt GrayFriend
Messages: 13
Registered: July 2009
Junior Member
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.

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. Sad
Re: Using a .jnilib file in released product [message #524266 is a reply to message #523954] Wed, 31 March 2010 11:22 Go to previous messageGo to next message
Ralf Ebert is currently offline Ralf EbertFriend
Messages: 168
Registered: July 2009
Senior Member
Hi Matt,

> 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/
Re: Using a .jnilib file in released product [message #528666 is a reply to message #522821] Wed, 21 April 2010 12:45 Go to previous message
Takacs Viktor is currently offline Takacs ViktorFriend
Messages: 1
Registered: April 2010
Junior Member
Hi,

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.

Any ideas or experience with Fobs4JMF?

Thanks,
Viktor
Previous Topic:creating/using linked resource group ui element
Next Topic:Semantic annotation toolkit
Goto Forum:
  


Current Time: Sat Nov 09 04:20:28 GMT 2024

Powered by FUDForum. Page generated in 0.03102 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top