Skip to content

Commit 634566a

Browse files
committed
调试报异常,不要点中断,点继续即可
1 parent 3af641a commit 634566a

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

CppCallJni.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,12 @@ extern "C" {
1616
int status = 0;
1717
JavaVM *pvm = NULL;
1818
JNIEnv *penv = NULL;
19-
JavaVMInitArgs args;
2019
JavaVMOption options[4];
2120
options[0].optionString = "-Djava.compiler=NONE";
2221
options[1] = { "-Djava.class.path=.;D:\\Program Files\\Java\\jre1.8.0_60\\lib\\dt.jar;D:\\Program Files\\Java\\jre1.8.0_60\\lib\\tools.jar", NULL };
2322
options[2].optionString = "-verbose:NONE";
2423
options[3].optionString = "-XX:+CreateMinidumpOnCrash";
25-
args.options = options;
26-
args.nOptions = 4;
27-
args.version = JNI_VERSION_1_8;
28-
args.ignoreUnrecognized = JNI_TRUE;
24+
JavaVMInitArgs args = { JNI_VERSION_1_8, 4, options, JNI_TRUE };
2925
char *jvmDll = JVM_DLL;
3026
HMODULE hmod = LoadLibraryA("D:\\Program Files\\Java\\jre1.8.0_60\\bin\\server\\jvm.dll");
3127
JNICreateJavaVM pJNICreateJavaVM = (JNICreateJavaVM)GetProcAddress(hmod, "JNI_CreateJavaVM");

build.bat

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ cmake -G "Visual Studio 14 2015 Win64" ..
99
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\vcvars32.bat"
1010
msbuild CppCallJni.vcxproj
1111
Debug\CppCallJni.exe
12+
dumpbin /dependents Debug\CppCallJni.exe
1213
popd
1314

15+
echo "调试时如果报异常,记得不要点击中断,要点击继续"
16+
1417
pause

0 commit comments

Comments
 (0)