Skip to content
Snippets Groups Projects
Commit 61e56929 authored by Tomasz Grabiec's avatar Tomasz Grabiec
Browse files

java: print exception thrown from FindClass

env->FindClass() triggers class initialization which may throw
exceptions. Instead of printing misleading information that the class
was not found we should print the exception stack-trace.
parent 0a21c05b
No related branches found
No related tags found
No related merge requests found
......@@ -137,9 +137,16 @@ int main(int argc, char **argv)
std::cerr << "java.so: Can't create VM.\n";
return 1;
}
auto mainclass = env->FindClass(RUNJAVA);
if (!mainclass) {
std::cerr << "java.so: Can't find class " << RUNJAVA << " in " << RUNJAVA_PATH << ".\n";
if (env->ExceptionOccurred()) {
std::cerr << "java.so: Failed to load " << RUNJAVA << "\n";
env->ExceptionDescribe();
env->ExceptionClear();
} else {
std::cerr << "java.so: Can't find class " << RUNJAVA << " in " << RUNJAVA_PATH << ".\n";
}
return 1;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment