[commit] r1103 - trunk/SDK/Java/native/JavaCompRunner

GMESRC Repository Notifications gme-commit at list.isis.vanderbilt.edu
Mon Nov 29 13:53:07 CST 2010


Author: ksmyth
Date: Mon Nov 29 13:53:07 2010
New Revision: 1103

Log:
GetLastError() if LoadLibrary(jvm.dll) fails

Modified:
   trunk/SDK/Java/native/JavaCompRunner/RawComponent.cpp

Modified: trunk/SDK/Java/native/JavaCompRunner/RawComponent.cpp
==============================================================================
--- trunk/SDK/Java/native/JavaCompRunner/RawComponent.cpp	Mon Nov 29 10:20:43 2010	(r1102)
+++ trunk/SDK/Java/native/JavaCompRunner/RawComponent.cpp	Mon Nov 29 13:53:07 2010	(r1103)
@@ -84,7 +84,20 @@
     m_javaVMDll = LoadLibrary(buf);
     if(m_javaVMDll == NULL)
     {
-        AfxMessageBox("Error loading java. Cannot find jvm.dll.");
+		LPTSTR errorText = NULL;
+
+		FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_IGNORE_INSERTS,
+		   NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+		   (LPTSTR)&errorText, 0, NULL);
+
+		if (NULL != errorText) {
+			std::string err = "Error loading java. Cannot load jvm.dll: ";
+			err += errorText;
+			AfxMessageBox(err.c_str());
+			LocalFree(errorText);
+		} else {
+	        AfxMessageBox("Error loading java. Cannot find jvm.dll.");
+		}
         unloadJavaVM();
         throw regkey;  
     }


More information about the gme-commit mailing list