Use Bundle-NativeCode on Linux not working

I am creating a plugin that includes the following folder structure:

  • src
  • native / so / libsystemcommand.so
  • META-INF / MANIFEST.MF

The manifest includes the command

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Commands Plug-in
Bundle-SymbolicName: de.system.commands;singleton:=true
Bundle-Version: 1.0.0
Bundle-Activator: de.system.commands.CommandsPlugin
Bundle-Localization: plugin
Bundle-NativeCode: native/so/libsystemcommand.so; osname = Linux; processor = x86
Require-Bundle: org.eclipse.core.runtime,
 org.apache.commons.logging
Eclipse-AutoStart: true
Export-Package: de.system.commands,
 de.system.commands.jni,
 de.system.commands.utils
Bundle-ClassPath: .

The build.properties construct looks like

source.. = src/
output.. = bin/
bin.includes = META-INF/,\
               .,\
               native/

In the method of starting my class, ActivatorI call

System.loadLibrary("systemcommand");

At runtime, the library was not found and an UnsatisfiedLinkError is called .

java.lang.UnsatisfiedLinkError: no libsystemcommand in java.library.path

Should I set more attributes in the plugin? Should I unzip some information on the target platform?

EDIT:

java.library.path=/opt/jdk/j2re1.4.2_16/lib/i386/client:/opt/jdk/j2re1.4.2_16/lib/i386:/opt/jdk/j2re1.4.2_16/../lib/i386::/opt/dsa/lib:/opt/dsa/lib
+5
source share
4 answers

I think I found a solution.

, , . , .

, , . unzipp, .

.

EDIT:

<installation>/eclipse/configuration/

<installation>/eclipse/configuration/config.ini
+1

, lib? .

System.loadLibrary("systemcommand");

gcc-.

+2

linux :

Bundle-NativeCode: librptlc.so; osname = linux; processor=x86

:

if (OS.equals(Platform.OS_LINUX)) {
    System.loadLibrary("rptlc");
}

.

, , , , . , .

You can also try to get the path to the library file system (not sure if this is easy) and load it using:

libraryPath = "C:\eclipse\bundles\123\librptlc.so";
System.load(libraryPath);
+1
source

The library must be on your file system (not in the archive). Then you can either use the linux environment variable LD_LIBRARY_PATHpointing to lib, or define the java.library.path property

0
source

All Articles