The Java Native InterfaceProgrammer’s Guide and Specification phần 8

Để minh họa cho giao diện lời gọi, chúng ta hãy nhìn vào một chương trình C tải một máy ảo Java và gọi phương thức quy định như sau: public class Prog {public static void main (String [] args) { ("Xin chào thế giới" + args | JNIFUNCTIONS ExceptionDescribe ExceptionDescribe Prototype void ExceptionDescribe JNIEnv env Description Prints the pending exception and a backtrace of the stack to the system error-reporting channel . This is a convenience routine provided for debugging. This function has the side effect of clearing the pending exception. Linkage Index 16 in the JNIEnv interface function table. Parameters env the JNIEnv interface pointer. Exceptions None. 211 ExceptionOccurred JNI FUNCTIONS ExceptionOccurred Prototype jthrowable ExceptionOccurred JNIEnv env Description Determines if an exception is pending in the current thread. The exception stays pending until either the native code calls ExceptionClear or the caller of the native method handles the exception. The difference between this function and ExceptionCheck added in Java 2 SDK release is that ExceptionCheck returns a jboolean to indicate whether there is a pending exception whereas this function returns a local reference to the pending exception or returns NULL if there is no pending exception. Linkage Index 15 in the JNIEnv interface function table. Parameters env the JNIEnv interface pointer. Return Values Returns the exception object that is pending in the current thread or NULL if no exception is pending. Exceptions None. 212 JNIFUNCTIONS FatalError FatalError Prototype void FatalError JNIEnv env const char msg Description Raises a fatal error and does not expect the virtual machine implementation to recover. Prints the message in a system debugging channel such as stderr and terminates the virtual machine instance. This function does not return. Linkage Index 18 in the JNIEnv interface function table. Parameters env the JNIEnv interface pointer. msg an error message. Exceptions None. .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.