开发者

Java - Difference between library and native library

开发者 https://www.devze.com 2022-12-30 23:38 出处:网络
Could anyone tell me the d开发者_运维技巧ifference between library and native library in terms of java? I found the word \"native library\" in the following line:

Could anyone tell me the d开发者_运维技巧ifference 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


"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.


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.


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消