⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 readme

📁 jni java本地接口编程例子原代码,是java调用本地操作系统代码的接口
💻
字号:
                                README                       Shared Stubs JNI Example-----------------------------------------------------------------------This directory contains an example demonstrating the use of sharedstubs for calling native code from Java(tm) applications.  Forinstance, we show how you could call the function printf from thestandard C library with little work.For more information about shared stubs, we encourage you to read thesource code in this directory; this is an annotated example! Startwith the file Main.java.At the time of this writing, we have implemented shared stubs forSPARC based Solaris(tm) and 32 bit Windows(tm) platforms.----------------------------------------------------------------------Contents----------------------------------------------------------------------We give a short description of the contents of this directory.  If youare learning this example, and how it works, it might help to browsethe files in the order listed here.    Main.java           Entry point to this example.  Shows how you                        would call C functions such as printf, scanf,			etc.    makefile.solaris    Makefiles for compiling and running this    makefile.win32      example on Solaris and Windows.    CFunction.java      An abstraction for a C funtion.  Users will                        create an instance of class CFunction, and then do                        a "callXXX" operation on that instance to cause                        the real C function to be called.    CPointer.java	An abstraction for a C pointer that points to			an arbitrary C type.  Think of an instance of			CPointer as a something that represents a			"void *". CPointer provides methods that let you			indirect the "void *" and get at what is			pointed at as a Java data type.    CMalloc.java        Just a CPointer, but the CPointer represents a C			pointer that has been malloc'ed on the C heap.			Use this if you have to pass malloc()'ed			memory to some CFunction.    dispatch.c		Implementation of the shared stub native methods.			    dispatch_sparc.s	SPARC specific parts of dispatch.c.    dispatch_x86.c	Win32/x86 specific parts of dispatch.c.----------------------------------------------------------------------Requirements----------------------------------------------------------------------To build and run this example you will need one of the followingoperating systems:         - SPARC based Solaris 2.4 (or higher)        - Windows NT 4.0        - Windows 95You will have to install JDK(tm) software, release 1.1 or higher.On Solaris you will need a C compiler (cc or gcc), and tools "as","ld" and "make", available in /usr/ccs/bin.  On Windows, you will needthe utilities "nmake" and "cl" from the Microsoft Developer Studiosuite of products; however, it should be trivial to create a makefileto run this example with other C compilers.----------------------------------------------------------------------Compiling and running----------------------------------------------------------------------On Solaris, if you have JDK software installed in /home/user/jdk,type:        % make -f makefile.solaris JDK=/home/user/jdkOn Win32, if you have JDK software installed in c:\jdk, type:        C:\JNI_Example> nmake -f makefile.win32 JDK=c:\jdkThe default target runs the example, in addition to compiling it.If you wish to only compile the example, specify the target "build"explicitly at the make command line.----------------------------------------------------------------------Comments and feedback----------------------------------------------------------------------Please send comments about this example, and JNI in general, to thealias "jni@java.sun.com".  We welcome your feedback!  Folks on thisalias are developers, and will not be able to provide support, butwill read comments.For support, please visit the Java(tm) Developer Connection at:              http://java.sun.com/jdcIf you find any bugs in this example, please send email to the JNIalias.  Please file JNI bug reports at:              http://java.sun.com/cgi-bin/bugreport.cgi

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -