tags:

views:

69

answers:

4

Could anyone tell me the difference between library and native library in terms of java? I found the word "native library" in the following line:

Type 1 - drivers that implement the JDBC API as a mapping to another data access API, such as ODBC. Drivers of this type are generally dependent on a native library, which limits their portability. The JDBC-ODBC Bridge driver is an example of a Type 1 driver.

which you can found here

+1  A: 

A native library is a library that contains "native" code. That is, code that has been compiled for a specific hardware architecture or operating system such as x86 or windows.

Including such native library in your project may break the platform-independence of you application.

aioobe
A: 

In this context, "library" is assumed to refer to a library written in Java (and probably distributed as a jar) whereas "native library" refers to a library written in something like C or OpenForth and compiled down to machine code.

Hank Gay
+7  A: 

"Native Library" generally means a non-Java library that's used by the system (so C/C++, etc). Think normal DLLs or libs.

Java can load these native libraries through JNI.

Herms
+1 for the reference to JNI
tangens
Can java load .dll files through JNI?
aioobe
Absolutely. I've only done it with DLLs specifically designed to work with JNI, so I'm not sure if you can load any DLL, but it's generally not too difficult to create a JNI wrapper for a normal native library (annoying busywork, but not generally hard).
Herms
A: 

In the context of Java, a library is one written in Java and available in the form of Java bytecode *.class files, typically compressed into a JAR archive. By contrast, a native library is one that has been compiled to machine code and is typically written in C or C++. Native libraries are *.so, *.dylib, *.dll, *.a, or *.lib files (depending on your platform) that link against the Java Native Interface (JNI) library and expose the functionality from C or C++ to Java through the Java Native Interace mechanism.

Michael Aaron Safyan