没有合适的资源?快使用搜索试试~ 我知道了~
java jni 教程 资料
5星 · 超过95%的资源 需积分: 9 186 下载量 15 浏览量
2009-12-04
11:12:47
上传
评论
收藏 660KB DOC 举报
温馨提示
试读
64页
This chapter introduces the Java Native Interface (JNI). The JNI is a native programming interface. It allows Java code that runs inside a Java Virtual Machine (VM) to interoperate with applications and libraries written in other programming languages, such as C, C++, and assembly The most important benefit of the JNI is that it imposes no restrictions on the implementation of the underlying Java VM. Therefore, Java VM vendors can add support for the JNI without affecting other parts of the VM. Programmers can write one version of a native application or library and expect it to work with all Java VMs supporting the JNI.
资源推荐
资源详情
资源评论
Java Native Interface Specificationy
1. Introduction
2. Design Overview
3. JNI Types and Data Structures
4. JNI Functions
5. The Invocation API
Chapter 1 Introduction
This chapter introduces the Java Native Interface (JNI). The JNI is a native programming
interface. It allows Java code that runs inside a Java Virtual Machine (VM) to interoperate with
applications and libraries written in other programming languages, such as C, C++, and assembly
!
"#
$
%#
$&
'
!
()*++,
Java Native Interface Overview
-
!Java native methods
"
.
/
0
#
0/
/
%.
(&1
2
(
("
3
!#
0Invocation API
#"/
#
Background
(
-4""
.
)*+5
67
678($
JDK 1.0 Native Method Interface
)*+59
&
:&
(;Java Language Specication
&
&
<)*+56
unhand
"#
#
Java Runtime Interface
7172
7
///#
7
412
Raw Native Interface and Java/COM Interface
'
=71727
/#
)*6&
7"
'>8($ /
($&&'
"($
Objectives
-//
.
Each VM vendor can support a larger body of native code.
Tool builders will not have to maintain different kinds of native method interfaces.
Application programmers will be able to write one version of their native code and this
version will run on different VMs.
?
@.
Binary compatibility - The primary goal is binary compatibility of native method libraries
across all Java VM implementations on a given platform. Programmers should maintain
only one version of their native method libraries for a given platform.
Efficiency - To support time-critical code, the native method interface must impose little
overhead. All known techniques to ensure VM-independence (and thus binary
compatibility) carry a certain amount of overhead. We must somehow strike a
compromise between efficiency and VM-independence.
Functionality - The interface must expose enough Java VM internals to allow native
methods to accomplish useful tasks.
Java Native Interface Approach
-"
9"
67
77
'!)
)
/7
7
67)*+5
#
7/
3#)*7
&(
.
RNI exposes the layout of internal Java objects to native code.
Direct access of Java objects as C structures makes it impossible to efficiently incorporate
“write barriers,” which are necessary in advanced garbage collection algorithms.
'($
#($@
($&
/#
($
.
First, the Java/COM interface lacks certain desired functions, such as accessing private
fields and raising general exceptions.
Second, the Java/COM interface automatically provides the standard IUnknown and
IDispatch COM interfaces for Java objects, so that native code can access public methods
and fields. Unfortunately, the IDispatch interface does not deal with overloaded Java
methods and is case-insensitive in matching method names. Furthermore, all Java
methods exposed through the IDispatch interface are wrapped to perform dynamic type
checking and coercion. This is because the IDispatch interface is designed with weakly-
typed languages (such as Basic) in mind.
Third, instead of dealing with individual low-level functions, COM is designed to allow
software components (including full-fledged applications) to work together. We believe
that it is not appropriate to treat all Java classes or low-level native methods as software
components.
Fourth, the immediate adoption of COM is hampered by the lack of its support on UNIX
platforms.
'"&($
&/($-
&($
This means that, as soon as cross-platform support for COM is
available, the JNI can become a COM interface to the Java VM.
-
'
#
剩余63页未读,继续阅读
资源评论
- wangzhengchu2014-08-06不错的资源,谢谢分享。
- binye333332014-01-27不错的资源,谢谢分享。
- a5944191012014-01-30没发现是英文版的资源
仓木小子
- 粉丝: 51
- 资源: 21
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- MyBatis动态SQL是一种强大的特性,它允许我们在SQL语句中根据条件动态地添加或删除某些部分,从而实现更加灵活和高效的数据
- MyBatis动态SQL是一种强大的特性,它允许我们在SQL语句中根据条件动态地添加或删除某些部分,从而实现更加灵活和高效的数据
- 【ERP标准流程-标准流程-进货管理】(DOC 17页).doc
- MyBatis动态SQL是一种强大的特性,它允许我们在SQL语句中根据条件动态地添加或删除某些部分,从而实现更加灵活和高效的数据
- MyBatis动态SQL是一种强大的特性,它允许我们在SQL语句中根据条件动态地添加或删除某些部分,从而实现更加灵活和高效的数据
- Java爬虫项目【项目开发计划】(共12页).docx
- 11111111111
- MyBatis动态SQL是一种强大的特性,它允许我们在SQL语句中根据条件动态地添加或删除某些部分,从而实现更加灵活和高效的数据
- MyBatis动态SQL是一种强大的特性,它允许我们在SQL语句中根据条件动态地添加或删除某些部分,从而实现更加灵活和高效的数据
- MyBatis动态SQL是一种强大的特性,它允许我们在SQL语句中根据条件动态地添加或删除某些部分,从而实现更加灵活和高效的数据
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功