Native Library in Eclipse RCP Plug-in
Adding native library in eclipse RCP is little-bit bit tricky part. Mainly native library has extensions like .so or .dll . There are multiple ways to define this kind of libraries to the eclipse RCP plug-in. (Follow steps one by one anyone of them will work.)
Here we take one example :
Suppose you have following directory structure
<dirPath>/NativeLibraryDirectory/
--- nativeFile.jar
--- nativeLib.so
1. Adding library to the project
For adding library to the project , right click on Project name -> select "Properties..." -> then go to "Java Build Path"
Add nativeFile.jar from External jar button.
Expand nativeFile.jar and double click on "native library location"
enter the path "<dirPath>/NativeLibraryDirectory/"
2. Using LD_LIBRARY_PATH
Set following environment before starting the Eclipse.
setenv LD_LIBRARY_PATH <dirPath>/NativeLibraryDirectory/:$LD_LIBRARY_PATH
3. Using -Djava.library.path
-Djava.library.path=<dirPath>/NativeLibraryDirectory/
4. Updating Menifiest (Bundle-Nativecode)
Add following line in MANIFEST.MF
Bundle-NativeCode: /libs/yourlib.dll; /libs/someotherlib.dll; osname=win32; processor=x86
Anyone of above method will work so try it one by one. The do following steps.
Before Using the libray in the code mention following lines
System.loadLibrary("nativeLib")
Adding native library in eclipse RCP is little-bit bit tricky part. Mainly native library has extensions like .so or .dll . There are multiple ways to define this kind of libraries to the eclipse RCP plug-in. (Follow steps one by one anyone of them will work.)
Here we take one example :
Suppose you have following directory structure
<dirPath>/NativeLibraryDirectory/
--- nativeFile.jar
--- nativeLib.so
1. Adding library to the project
For adding library to the project , right click on Project name -> select "Properties..." -> then go to "Java Build Path"
Add nativeFile.jar from External jar button.
Expand nativeFile.jar and double click on "native library location"
enter the path "<dirPath>/NativeLibraryDirectory/"
2. Using LD_LIBRARY_PATH
Set following environment before starting the Eclipse.
setenv LD_LIBRARY_PATH <dirPath>/NativeLibraryDirectory/:$LD_LIBRARY_PATH
3. Using -Djava.library.path
-Djava.library.path=<dirPath>/NativeLibraryDirectory/
4. Updating Menifiest (Bundle-Nativecode)
Add following line in MANIFEST.MF
Bundle-NativeCode: /libs/yourlib.dll; /libs/someotherlib.dll; osname=win32; processor=x86
Anyone of above method will work so try it one by one. The do following steps.
Before Using the libray in the code mention following lines
System.loadLibrary("nativeLib")
Comments
Post a Comment