Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » JNI java.lang.UnsatisfiedLinkError with chain of libraries
JNI java.lang.UnsatisfiedLinkError with chain of libraries [message #645773] Mon, 20 December 2010 14:26 Go to next message
Benjamin Bihler is currently offline Benjamin BihlerFriend
Messages: 20
Registered: July 2009
Junior Member
Hi,


can someone help me with loading native libraries in an eclipse fragment? My fragment on a Linux 64 bit system contains the following code:

public void loadLibraries()
{
System.out.println( "LD_LIBRARY_PATH: " + System.getenv( "LD_LIBRARY_PATH" ) );

try
{
System.out.println( "Loading library 2" );
System.loadLibrary( "2" );
System.out.println( "Loading library 1" );
System.loadLibrary( "1" );

System.out.println( "Finished loading libraries!" );
}
catch( UnsatisfiedLinkError unsatisfiedLinkError )
{
unsatisfiedLinkError.printStackTrace();
}
}

and two libraries "lib1.so" and "lib2.so" in the fragment root path.

Loading library 2 works great, since it does not depend on any other libraries. But library 1 is linked against library 2. When I try to load it I get this output:

------------------------------------------------------------ -------------------------
LD_LIBRARY_PATH: /usr/lib/jvm/java-6-sun-1.6.0.22/jre/lib/amd64/server:/usr/l ib/jvm/java-6-sun-1.6.0.22/jre/lib/amd64:/usr/lib/jvm/java-6 -sun-1.6.0.22/jre/../lib/amd64:/usr/lib64/xulrunner-addons
Loading library 2
Loading library 1
java.lang.UnsatisfiedLinkError: /home/bbihler/StarTeam/ModelManager/Development/ExtensionPlu gins/MeshingLibWrapperLinux64/lib1.so: lib2.so: Kann die Shared-Object-Datei nicht öffnen: Datei oder Verzeichnis nicht gefunden
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1803)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1712)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1028)
at com.twt.meshinglibwrapper.linux64.libraryloaders.Linux64Libr aryLoader.loadLibraries(Linux64LibraryLoader.java:17)
at com.twt.meshinglibwrapper.activators.MeshingLibWrapperActiva tor.loadLibraries(MeshingLibWrapperActivator.java:50)
at com.twt.batchmerger.handlers.BatchMergeHandler.execute(Batch MergeHandler.java:28)
at org.eclipse.ui.internal.handlers.HandlerProxy.execute(Handle rProxy.java:293)
at org.eclipse.core.commands.Command.executeWithChecks(Command. java:476)
at org.eclipse.core.commands.ParameterizedCommand.executeWithCh ecks(ParameterizedCommand.java:508)
at org.eclipse.ui.internal.handlers.HandlerService.executeComma nd(HandlerService.java:169)
at org.eclipse.ui.internal.handlers.SlaveHandlerService.execute Command(SlaveHandlerService.java:241)
at org.eclipse.ui.menus.CommandContributionItem.handleWidgetSel ection(CommandContributionItem.java:820)
at org.eclipse.ui.menus.CommandContributionItem.access$19(Comma ndContributionItem.java:806)
at org.eclipse.ui.menus.CommandContributionItem$5.handleEvent(C ommandContributionItem.java:796)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3540)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3161)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2640)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:24 38)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
at org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:664)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
at com.twt.modelmanager.gui.Application.start(Application.java: 130)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:369)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 619)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
at org.eclipse.equinox.launcher.Main.main(Main.java:1383)

------------------------------------------------------------ -------------------------

I have searched the internet for hints how to load libraries with dependencies, but the only advice I have found was to load the base libraries before the depending libraries. In the example above I already do this, but it does not work.

Can someone help me?


Thank you very much,
Benjamin Bihler
Re: JNI java.lang.UnsatisfiedLinkError with chain of libraries [message #645950 is a reply to message #645773] Tue, 21 December 2010 10:06 Go to previous message
Benjamin Bihler is currently offline Benjamin BihlerFriend
Messages: 20
Registered: July 2009
Junior Member
I have found the reason why loading the basic libraries before the depending libraries does not work in my case: this is only a workaround on Windows systems, not on Linux systems.

My problem was reported as the following bug:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=139064

Unfortunately there seems to be no clear solution... any help is appreciated!!!


Benjamin
Previous Topic:Is it necessary to add a plugin dependency when using extension points?
Next Topic:File Selection from within VariableResolver
Goto Forum:
  


Current Time: Thu Apr 25 04:25:03 GMT 2024

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

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

Back to the top