exceptionlibrary.cpp

来自「< Professional Java,JDK 5 Edition>」· C++ 代码 · 共 28 行

CPP
28
字号
// ExceptionLibrary.cpp : Defines the entry point for the DLL application.
//

#include "stdafx.h"
#include "../ExceptionExample.h"

JNIEXPORT void JNICALL Java_ExceptionExample_testExceptions
  (JNIEnv *env, jobject obj)
{
    // Try to find a class that isn't there to trigger an exception
    env->FindClass("NoSuchClass");

    // If an exception happened, print it out and then clear it
    if(env->ExceptionCheck()) {
        env->ExceptionDescribe();
        env->ExceptionClear();
    }
}

BOOL APIENTRY DllMain( HANDLE hModule, 
                       DWORD  ul_reason_for_call, 
                       LPVOID lpReserved
					 )
{
    return TRUE;
}

⌨️ 快捷键说明

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