- 浏览: 1481971 次
- 性别:
- 来自: 南京
文章分类
- 全部博客 (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 486... -
druid 数据库密码加密
2015-03-12 17:43 1349cmd命令:1、切换的druid-0.2.9.jar包所在目 ... -
检测Java对象所占内存大小
2012-05-29 16:57 1247http://blog.csdn.net/zzt_johnso ... -
在 JNI 编程中避免内存泄漏
2012-04-16 15:55 1122http://www.ibm.com/developerwor ... -
Java Native Interface Specification
2012-04-16 15:04 1534http://docs.oracle.com/javase/1 ... -
基本JNI调用技术(c/c++与java互调)
2012-04-16 15:03 1268http://blog.csdn.net/zjsjava/ar ... -
ProGuard
2012-04-10 21:34 896http://proguard.sourceforge.net ... -
[Java]将一个字符串按照指定字符数进行分割
2012-03-27 13:20 3437public static String[] spli ... -
java中的字符串分割函数
2012-03-27 10:26 14063Java中的我们可以利用split把字符串按照指定的分割符进行 ... -
Java 可中断线程
2012-03-26 13:27 4154http://blog.csdn.net/sapphiron/ ... -
如何中断线程in Java
2012-03-26 13:08 1122http://android.blog.51cto.com/2 ... -
Android多线程设计模式之-wait()和notify()机制
2012-03-26 12:50 1856通常,多线程之间需要 ... -
[AndroidTips]Android how to check screen off 判断屏幕是开还是关
2012-03-21 15:58 1532pm = (PowerManager) context.get ... -
java中关键字volatile的作用
2012-03-21 11:30 1160http://sakyone.iteye.com/blog/6 ... -
mytracks - MyTracks for Android
2012-03-20 10:10 1716http://code.google.com/p/mytrac ... -
EasyMock 使用方法与原理剖析
2012-03-19 13:22 1094https://www.ibm.com/developerwo ... -
maven设置HTTP代理
2012-03-16 14:52 5525http://maven.apache.org/ Apa ... -
Dalvik虚拟机的垃圾回收
2012-03-01 15:59 3433http://blog.csdn.net/caimouse/a ... -
Memory Management for Android Apps
2012-02-29 22:34 1059http://www.google.com/events/io ... -
Android GC
2012-02-29 21:32 304728470 dalvikvm D ...
相关推荐
Java Native Interface Chapter 9. AWT and Swing Chapter 10. Java and XML Chapter 11. Input/Output PART II: NETWORK PROGRAMMING Chapter 12. Basic Networking Chapter 13. Socket Programming Chapter 14. ...
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 ...
This tutorial deals with the two most common applications of JNI: calling C/C++ code from ...of the Java Native Interface and some of the more advanced programming challenges that can arise.
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 ...
Java is popular among professional programmers because it can be used to build visually interesting graphical user interface (GUI) and Web-based applications. Java also provides an excellent ...
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
Explains the use of the powerful JNI (Java Native Interface) for combining Java and C++ Includes a summary of key C++ features and issues with each chapter Provides extensive treatment of C details ...
Best practices for using the Java Native Interface Techniques and tools for averting the 10 most common JNI programming mistakes.
Java Virtual Machine Support for Non-Java Languages: Java SE 7 introduces a new JVM instruction that simplifies the implementation of dynamically typed programming languages on the JVM. Garbage-First...
The Java Programming Language Architectural Tradeoffs Future Trends On the CD-ROM The Resources Page 2 Platform independence Why Platform Independence? Java's Architectural Support for Platform ...
The Java Programming Environment Chapter 3. Fundamental Programming Structures in Java Chapter 4. Objects and Classes Chapter 5. Inheritance Chapter 6. Interfaces and Inner Classes Chapter 7. ...
Java As a Programming Platform 2 The Java “White Paper” Buzzwords 2 Java Applets and the Internet 7 A Short History of Java 9 Common Misconceptions about Java 11 Chapter 2: The Java ...
Volume II–Advanced Features, covers advanced user-interface programming and the enterprise features of the Java SE 6 platform. Like Volume I (which covers the core language and library features), ...
Use the JNI interface to execute concurrent work on native layer Pull and push data from your network servers using the Google GCM platform Create and compose tasks with RxJava to execute complex ...
Java Native Interface (JNI) Security XML (JAXP) Integration Libraries Java Database Connectivity (JDBCTM) Java IDL Java Naming and Directory InterfaceTM (JNDI) Remote Method Invocation ...
为解决使用常用图像拉伸方式将解码到的视频图像实时放大输出时遇到的内存严重消耗和输出延迟的问题,分析了问题的原因,并研究了基于Android 自带API( Application Programming Interface)或使用JNI( Java Native ...
Use the JNI interface to execute concurrent work on native layer Pull and push data from your network servers using the Google GCM platform Create and compose tasks with RxJava to execute complex ...
WebSockets and server-sent events provide not only a standard against which real-time web applications can be built, but also a socket, native to the browser, that facilitates network programming ...
Take your coding skills to the next level with this extensive guide to Objective–C, the native programming language for developing sophisticated software applications for Mac OS X. Objective–C is a ...