Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does "Native library location" entry do in Eclipse?

If adding user-defined library in Eclipse, one has an ability to set "Native library location". This field allows to enter some directory path.

When does this path plays a part?

like image 779
Suzan Cioc Avatar asked Nov 04 '13 12:11

Suzan Cioc


People also ask

What is native library location in Eclipse?

Go to Project properties->Java Build Path->Source. You'll find a list of source-folders. Each entry under the the Source tab has Native library locations.

What is the use of native library in Java?

<uses-native-library>Specifies a vendor-provided shared native library that the application must be linked against. This element tells the system to make the native library accessible for the package.

What is native library path?

Native libraries are platform-specific library files, including . dll, . so, or *SRVPGM objects, that can be configured within shared libraries. Native libraries are visible to an application class loader whenever the shared library is associated with an application.

What is library path in Java?

library. path is a System property, which is used by Java programming language, mostly JVM, to search native libraries, required by a project. Similar to PATH and Classpath environment variable, java. library.


1 Answers

Eclipse uses this information to build the java.library.path when it launches a Java program.

Background: Some Java frameworks depend on native code. This code usually comes in the form of a native shared library (*.so, *.dll). In Java, you can see methods with the attribute native. The code will load the shared library using System.loadLibrary().

In order to make the code independent of absolute paths, you just pass the name of the shared library to System.loadLibrary(). The System property java.library.path is then used to determine in which directories the VM should look to locate the file.

Together with Eclipse's feature to define user libraries, you can easily add Java libraries that depend on native code to your projects.

like image 107
Aaron Digulla Avatar answered Sep 18 '22 20:09

Aaron Digulla