- 浏览: 1504754 次
- 性别:
- 来自: 南京
文章分类
- 全部博客 (419)
- XMPP (19)
- Android (180)
- Java (59)
- Network (4)
- HTML5 (13)
- Eclipse (9)
- SCM (23)
- C/C++ (4)
- UML (4)
- Libjingle (15)
- Tools&Softwares (29)
- Linphone (5)
- Linux&UNIX (6)
- Windows (18)
- Google (10)
- MISC (3)
- SIP (6)
- SQLite (5)
- Security (4)
- Opensource (29)
- Online (2)
- 文章 (3)
- MemoryLeak (10)
- Decompile (5)
- Ruby (1)
- Image (1)
- Bat (4)
- TTS&ASR (28)
- Multimedia (1)
- iOS (20)
- Asciiflow - ASCII Flow Diagram Tool.htm (1)
- Networking (1)
- DLNA&UPnP (2)
- Chrome (2)
- CI (1)
- SmartHome (0)
- CloudComputing (1)
- NodeJS (3)
- MachineLearning (2)
最新评论
-
bzhao:
点赞123!
Windows的adb shell中使用vi不乱码方法及AdbPutty -
wahahachuang8:
我觉得这种东西自己开发太麻烦了,就别自己捣鼓了,找个第三方,方 ...
HTML5 WebSocket 技术介绍 -
obehavior:
view.setOnTouchListenerview是什么
[转]android 一直在最前面的浮动窗口效果 -
wutenghua:
[转]android 一直在最前面的浮动窗口效果 -
zee3.lin:
Sorry~~
When I build "call ...
Step by Step about How to Build libjingle 0.4
http://journals.ecs.soton.ac.uk/java/tutorial/native1.1/implementing/index.html
Java Native Interface Programming
The JDK1.1 supports the Java Native Interface (JNI). On one hand, the JNI defines a standard naming and calling convention so that the Java Virtual Machine (VM) can locate and invoke your native methods. On the other hand, the JNI offers a set of standard interface functions. You call JNI functions from your native method code to do such things as access and manipulate Java objects, release Java objects, create new objects, call Java methods, and so on.
This section shows you how to follow the JNI naming and calling conventions, and how to use JNI functions from a native method. Each example consists of a Java program that calls various native methods implemented in C. The native methods, in turn, may call JNI functions to access the Java objects.
The section also shows you how to embed the Java Virtual Machine into a native application.
Declaring Native Methods
On the Java side, you declare a native method with thenative
keyword and an empty method body. On the native language side, you provide an implementation for the native method. You must take care when writing native methods to "match" the native function implementation with the method signature in Java.javah
, explained in Step 3: Create the .h file , is a helpful tool to generate native function prototypes that match the Java native method declaration.Mapping between Java and Native Types
The JNI defines a mapping of Java types and native (C/C++) types. This section introduces the native types corresponding to both primitive Java types (e.g.,int
,double
) and Java objects (including strings and arrays).Accessing Java Strings
Strings are a particularly useful kind of Java objects. The JNI provides a set of string manipulation functions to ease the task of handling Java strings in native code. The programmer can translate between Java strings and native strings in Unicode and UTF-8 formats.Accessing Java Arrays
Arrays are another kind of frequently-used Java object. You can use JNI array manipulation functions to create arrays and access array elements.Calling Java Methods
The JNI supports a complete set of "callback" operations that allow you to invoke a Java method from the native code. You locate the method using its name and signature. You can invoke both static and instance (non-static) methods.javap
is a helpful tool to generate JNI-style method signatures from class files.Accessing Java Fields
The JNI allows you to locate the field using the field's name and type signature. You can get hold of both static and instance (non-static) fields.javap
is a helpful tool to generate JNI-style field signatures from class files.Catching and Throwing Exceptions
This section teaches you how to deal with exceptions from within a native method implementation. Your native method can catch, throw, and clear exceptions.Local and Global References
Native code can refer to Java objects using either local or global references. Local references are only valid within a native method invocation. They are freed automatically after the native method returns. You must explicitly allocate and free global references.Threads and Native Methods
This section describes the implications of running native methods in the multi-threaded Java environment. The JNI offers basic synchronization constructs for native methods.Invoking the Java Virtual Machine
This section shows you how to load the Java Virtual Machine from a native library into a native application. This lesson includes how to initialize the Java Virtual Machine and invoke Java methods. The Invocation API also allows native threads to attach to a running Java Virtual Machine and bootstrap themselves into Java threads. Currently, the JDK only supports attaching native threads on Win32. The support for Solaris native threads will be available in a future release.JNI Programming in C++
In C++, the JNI presents a slightly cleaner interface and performs additional static type checking.
发表评论
-
JAAS authentication in Tomcat example
2018-11-19 20:32 630... -
druid 数据库密码加密
2015-03-12 17:43 1394cmd命令:1、切换的druid-0.2.9.jar包所在目 ... -
检测Java对象所占内存大小
2012-05-29 16:57 1292http://blog.csdn.net/zzt_johnso ... -
在 JNI 编程中避免内存泄漏
2012-04-16 15:55 1171http://www.ibm.com/developerwor ... -
Java Native Interface Specification
2012-04-16 15:04 1617http://docs.oracle.com/javase/1 ... -
基本JNI调用技术(c/c++与java互调)
2012-04-16 15:03 1310http://blog.csdn.net/zjsjava/ar ... -
ProGuard
2012-04-10 21:34 934http://proguard.sourceforge.net ... -
[Java]将一个字符串按照指定字符数进行分割
2012-03-27 13:20 3486public static String[] spli ... -
java中的字符串分割函数
2012-03-27 10:26 14124Java中的我们可以利用split把字符串按照指定的分割符进行 ... -
Java 可中断线程
2012-03-26 13:27 4196http://blog.csdn.net/sapphiron/ ... -
如何中断线程in Java
2012-03-26 13:08 1164http://android.blog.51cto.com/2 ... -
Android多线程设计模式之-wait()和notify()机制
2012-03-26 12:50 1933通常,多线程之间需要 ... -
[AndroidTips]Android how to check screen off 判断屏幕是开还是关
2012-03-21 15:58 1580pm = (PowerManager) context.get ... -
java中关键字volatile的作用
2012-03-21 11:30 1202http://sakyone.iteye.com/blog/6 ... -
mytracks - MyTracks for Android
2012-03-20 10:10 1762http://code.google.com/p/mytrac ... -
EasyMock 使用方法与原理剖析
2012-03-19 13:22 1127https://www.ibm.com/developerwo ... -
maven设置HTTP代理
2012-03-16 14:52 5564http://maven.apache.org/ Apa ... -
Dalvik虚拟机的垃圾回收
2012-03-01 15:59 3479http://blog.csdn.net/caimouse/a ... -
Memory Management for Android Apps
2012-02-29 22:34 1101http://www.google.com/events/io ... -
Android GC
2012-02-29 21:32 309828470 dalvikvm D ...
相关推荐
Chapter 11 - Java Native Interface Chapter 12 - 3D Graphics Foundations Chapter 13 - Java Bindings to OpenGL (JOGL) Chapter 14 - Overlays and Menus Using JOGL Chapter 15 - 3D Render Engine ...
本教程主要关注Java Native Interface (JNI) 的使用。JNI是Java Software Development Kit (SDK) 的一部分,它允许Java代码调用用其他语言(如C和C++)编写的代码或库。通过JNI中的Invocation API,可以在本地应用...
直接缓冲区在Java中使用JNI(Java Native Interface)直接在物理内存中分配,而不需要经过Java堆,这通常能提高性能,尤其是在大量I/O操作时。 `DirectByteBufferExample.java`这个文件很可能是书中一个示例程序,...
- `interface`:接口声明。 - `long`:64位整型数据类型。 - `native`:声明原生方法。 - `new`:创建新对象。 - `null`:空引用。 - `package`:声明包。 - `private`:私有访问修饰符。 - `protected`:受保护的...
Java提供了Java2D和JavaFX库来处理2D和3D图形,开发者可以学习如何绘制图像、动画,以及如何利用OpenGL通过JNI(Java Native Interface)进行高性能图形渲染。 3. **游戏框架**:书中可能会介绍如LibGDX、...
7. **JNI(Java Native Interface)**:Java与本地代码交互的接口,允许Java程序调用C/C++库。 8. **JIT(Just-In-Time)编译器**:JVM的一种优化技术,将热点代码编译为本地机器码以提高运行效率。 9. **类文件...
### Java Native Interface (JNI)详解 #### 一、引言 **Java Native Interface (JNI)** 是一种标准的应用程序编程接口(API),它允许Java代码与其他语言编写的代码进行交互,特别是与C和C++代码交互。JNI是Java平台...
Java程序设计与JNI手册详细介绍了Java Native Interface(JNI)的基础和常用技术,旨在帮助开发者快速有效地开发自己的JNI解决方案。JNI是Java软件开发工具包(SDK)的一部分,它允许Java代码调用用其他语言(如C和...
1. **Java Native Interface (JNI)**:JNI是Java平台的标准部分,它允许Java代码和其他语言写的代码进行交互。在Jacob中,JNI被用来连接Java虚拟机和Windows COM组件。 2. **Jacob库的使用**:首先需要将Jacob的jar...
**Java Native Interface (JNI)** 是Java Software Development Kit (SDK) 的一部分,它提供了一个原生接口,使得Java代码能够调用其他语言(如C/C++)编写的代码或库。通过JNI中的Invocation API,可以在本地应用...
JDBC Technology Servlets Chapter 5: Java Native Interface (JNI) Technology <br>JNI Example Strings and Arrays Other Programming Issues Chapter 6. Project Swing: Building a ...
Extend your Java skills beyond the fundamental object-oriented concepts and ... Work with JavaFX, RMI (Remote Method Invocation), and JNI (Java Native Interface) Use the new scripting features of Java
2. linux:这可能是一个目录,包含适用于Linux操作系统的SAP JCO native library,如libjco.so,它是Java Native Interface (JNI) 的一部分,用于处理与操作系统底层交互的部分,如网络通信和内存管理。 3. win:...
- **JNI概念**:Java Native Interface允许Java代码调用本地C/C++代码,从而实现更高的性能或者调用第三方库。 - **JNI开发注意事项**:由于涉及不同语言之间的交互,JNI开发需要注意内存管理、异常处理等问题。 ##...
4. **JNI(Java Native Interface)**:学习如何通过JNI与C/C++原生代码交互,以利用Java无法直接提供的系统功能或优化性能。 5. **内存管理和垃圾回收**:理解Java内存模型,包括堆内存、栈内存和方法区,以及垃圾...
本地方法是Java代码中使用`native`关键字声明的函数,它们与特定操作系统紧密关联,通常用C或C++编写,并通过Java的JNI(Java Native Interface)来调用。 在描述中提到的`native_method_src`文件夹,很可能包含了...
Best practices for using the Java Native Interface Techniques and tools for averting the 10 most common JNI programming mistakes.
它实现了SAP系统的远程调用功能,允许Java代码通过JNI(Java Native Interface)与SAP系统交互。在Windows系统中,Java程序不能直接调用C/C++编写的原生代码,因此需要这样的DLL来桥接Java和SAP的原生接口。 2. sap...