+ _Jv_InitThreads ();
+ _Jv_InitGC ();
+ _Jv_InitializeSyncMutex ();
+
+ /* Initialize Utf8 constants declared in jvm.h. */
+ void_signature = _Jv_makeUtf8Const ("()V", 3);
+ clinit_name = _Jv_makeUtf8Const ("<clinit>", 8);
+ init_name = _Jv_makeUtf8Const ("<init>", 6);
+ finit_name = _Jv_makeUtf8Const ("finit$", 6);
+
+ /* Initialize built-in classes to represent primitive TYPEs. */
+ _Jv_InitPrimClass (&_Jv_byteClass, "byte", 'B', 1, &_Jv_byteVTable);
+ _Jv_InitPrimClass (&_Jv_shortClass, "short", 'S', 2, &_Jv_shortVTable);
+ _Jv_InitPrimClass (&_Jv_intClass, "int", 'I', 4, &_Jv_intVTable);
+ _Jv_InitPrimClass (&_Jv_longClass, "long", 'J', 8, &_Jv_longVTable);
+ _Jv_InitPrimClass (&_Jv_booleanClass, "boolean", 'Z', 1, &_Jv_booleanVTable);
+ _Jv_InitPrimClass (&_Jv_charClass, "char", 'C', 2, &_Jv_charVTable);
+ _Jv_InitPrimClass (&_Jv_floatClass, "float", 'F', 4, &_Jv_floatVTable);
+ _Jv_InitPrimClass (&_Jv_doubleClass, "double", 'D', 8, &_Jv_doubleVTable);
+ _Jv_InitPrimClass (&_Jv_voidClass, "void", 'V', 0, &_Jv_voidVTable);
+
+ // Turn stack trace generation off while creating exception objects.
+ _Jv_InitClass (&java::lang::Throwable::class$);
+ java::lang::Throwable::trace_enabled = 0;
+
+ INIT_SEGV;
+#ifdef HANDLE_FPE
+ INIT_FPE;
+#else
+ arithexception = new java::lang::ArithmeticException
+ (JvNewStringLatin1 ("/ by zero"));
+#endif
+
+ no_memory = new java::lang::OutOfMemoryError;
+
+ java::lang::Throwable::trace_enabled = 1;
+
+#ifdef USE_LTDL
+ LTDL_SET_PRELOADED_SYMBOLS ();
+#endif
+
+#ifdef USE_WINSOCK
+ // Initialise winsock for networking
+ WSADATA data;
+ if (WSAStartup (MAKEWORD (1, 1), &data))
+ MessageBox (NULL, "Error initialising winsock library.", "Error", MB_OK | MB_ICONEXCLAMATION);
+#endif /* USE_WINSOCK */
+
+#ifdef USE_WIN32_SIGNALLING
+ // Install exception handler
+ SetUnhandledExceptionFilter (win32_exception_handler);
+#elif defined(HAVE_SIGACTION)
+ // We only want this on POSIX systems.
+ struct sigaction act;
+ act.sa_handler = SIG_IGN;
+ sigemptyset (&act.sa_mask);
+ act.sa_flags = 0;
+ sigaction (SIGPIPE, &act, NULL);
+#else
+ signal (SIGPIPE, SIG_IGN);
+#endif
+
+ _Jv_JNI_Init ();
+
+ _Jv_GCInitializeFinalizers (&::gnu::gcj::runtime::FinalizerThread::finalizerReady);
+
+ // Start the GC finalizer thread. A VirtualMachineError can be
+ // thrown by the runtime if, say, threads aren't available. In this
+ // case finalizers simply won't run.
+ try
+ {
+ using namespace gnu::gcj::runtime;
+ FinalizerThread *ft = new FinalizerThread ();
+ ft->start ();
+ }
+ catch (java::lang::VirtualMachineError *ignore)
+ {
+ }
+
+ return 0;
+}
+
+void
+_Jv_RunMain (jclass klass, const char *name, int argc, const char **argv,
+ bool is_jar)
+{
+ _Jv_argv = argv;
+ _Jv_argc = argc;
+
+ java::lang::Runtime *runtime = NULL;
+