--- old/src/java.base/macosx/native/libjli/java_md_macosx.c 2015-04-14 18:26:01.000000000 +0300 +++ new/src/java.base/macosx/native/libjli/java_md_macosx.c 2015-04-14 18:26:01.000000000 +0300 @@ -948,8 +948,15 @@ jmethodID getCanonicalNameMID = NULL; NULL_CHECK(getCanonicalNameMID = (*env)->GetMethodID(env, classClass, "getCanonicalName", "()Ljava/lang/String;")); - jstring mainClassString = NULL; - NULL_CHECK(mainClassString = (*env)->CallObjectMethod(env, mainClass, getCanonicalNameMID)); + jstring mainClassString = (*env)->CallObjectMethod(env, mainClass, getCanonicalNameMID); + if ((*env)->ExceptionCheck(env)) { + /* + * Clears all errors caused by getCanonicalName() on the mainclass and + * leaves the JAVA_MAIN_CLASS__ empty. + */ + (*env)->ExceptionClear(env); + return; + } const char *mainClassName = NULL; NULL_CHECK(mainClassName = (*env)->GetStringUTFChars(env, mainClassString, NULL)); @@ -1056,7 +1063,7 @@ * Note the jvmInstance must be initialized first before entering into * ShowSplashScreen, as there is a callback into the JLI_GetJavaVMInstance. */ -void PostJVMInit(JNIEnv *env, jstring mainClass, JavaVM *vm) { +void PostJVMInit(JNIEnv *env, jclass mainClass, JavaVM *vm) { jvmInstance = vm; SetMainClassForAWT(env, mainClass); CHECK_EXCEPTION_RETURN();