+# if defined(WITH_CLASSPATH_GNU)
+ classpath_libdir = CLASSPATH_LIBDIR"/classpath";
+# else
+ classpath_libdir = CLASSPATH_LIBDIR;
+# endif
+#endif
+
+ /* set the bootclasspath */
+
+ cp = getenv("BOOTCLASSPATH");
+
+ if (cp != NULL) {
+ _Jv_bootclasspath = MNEW(char, strlen(cp) + strlen("0"));
+ strcpy(_Jv_bootclasspath, cp);
+ }
+ else {
+#if defined(WITH_JRE_LAYOUT)
+ len =
+# if defined(WITH_CLASSPATH_GNU)
+ strlen(cacao_prefix) +
+ strlen("/share/cacao/vm.zip") +
+ strlen(":") +
+# endif
+ strlen(cacao_prefix) +
+ strlen("/share/classpath/glibj.zip") +
+ strlen("0");
+
+ _Jv_bootclasspath = MNEW(char, len);
+# if defined(WITH_CLASSPATH_GNU)
+ strcat(_Jv_bootclasspath, cacao_prefix);
+ strcat(_Jv_bootclasspath, "/share/cacao/vm.zip");
+ strcat(_Jv_bootclasspath, ":");
+# endif
+ strcat(_Jv_bootclasspath, cacao_prefix);
+ strcat(_Jv_bootclasspath, "/share/classpath/glibj.zip");
+#else
+# if defined(WITH_CLASSPATH_GNU)
+ len =
+ strlen(CACAO_VM_ZIP) +
+ strlen(":") +
+ strlen(CLASSPATH_CLASSES) +
+ strlen("0");
+# elif defined(WITH_CLASSPATH_SUN)
+ /* This is the bootclasspath taken from HotSpot (see
+ hotspot/src/share/vm/runtime/os.cpp
+ (os::set_boot_path)). */
+
+ len =
+ strlen(CLASSPATH_PREFIX"/lib/resources.jar:"
+ CLASSPATH_PREFIX"/lib/rt.jar:"
+ CLASSPATH_PREFIX"/lib/sunrsasign.jar:"
+ CLASSPATH_PREFIX"/lib/jsse.jar:"
+ CLASSPATH_PREFIX"/lib/jce.jar:"
+ CLASSPATH_PREFIX"/lib/charsets.jar:"
+ CLASSPATH_PREFIX"/classes") +
+ strlen("0");
+# elif defined(WITH_CLASSPATH_CLDC1_1)
+ len =
+ strlen(CLASSPATH_CLASSES) +
+ strlen("0");
+# else
+# error unknown classpath configuration
+# endif
+
+ _Jv_bootclasspath = MNEW(char, len);
+
+# if defined(WITH_CLASSPATH_GNU)
+ strcpy(_Jv_bootclasspath, CACAO_VM_ZIP);
+ strcat(_Jv_bootclasspath, ":");
+ strcat(_Jv_bootclasspath, CLASSPATH_CLASSES);
+# elif defined(WITH_CLASSPATH_SUN)
+ strcpy(_Jv_bootclasspath,
+ CLASSPATH_PREFIX"/lib/resources.jar:"
+ CLASSPATH_PREFIX"/lib/rt.jar:"
+ CLASSPATH_PREFIX"/lib/sunrsasign.jar:"
+ CLASSPATH_PREFIX"/lib/jsse.jar:"
+ CLASSPATH_PREFIX"/lib/jce.jar:"
+ CLASSPATH_PREFIX"/lib/charsets.jar:"
+ CLASSPATH_PREFIX"/classes");
+# elif defined(WITH_CLASSPATH_CLDC1_1)
+ strcat(_Jv_bootclasspath, CLASSPATH_CLASSES);
+# else
+# error unknown classpath configuration
+# endif
+#endif
+ }
+
+ /* set the classpath */
+
+ cp = getenv("CLASSPATH");
+
+ if (cp != NULL) {
+ _Jv_classpath = MNEW(char, strlen(cp) + strlen("0"));
+ strcat(_Jv_classpath, cp);
+ }
+ else {
+ _Jv_classpath = MNEW(char, strlen(".") + strlen("0"));
+ strcpy(_Jv_classpath, ".");
+ }
+
+ /* Get and set java.library.path. */
+
+ _Jv_java_library_path = getenv("LD_LIBRARY_PATH");
+
+ if (_Jv_java_library_path == NULL)
+ _Jv_java_library_path = "";
+
+ /* interpret the options **************************************************/
+
+ opt_version = false;
+ opt_exit = false;
+
+ opt_noieee = false;
+
+ opt_heapmaxsize = HEAP_MAXSIZE;
+ opt_heapstartsize = HEAP_STARTSIZE;
+ opt_stacksize = STACK_SIZE;
+
+
+#if defined(ENABLE_JVMTI)
+ /* initialize JVMTI related **********************************************/
+ jvmti = false;
+#endif
+
+ /* Initialize and fill properties before command-line handling. */
+
+ if (!properties_init())
+ vm_abort("vm_create: properties_init failed");
+
+ /* Set the classpath properties. */
+
+#if defined(ENABLE_JAVASE)
+ properties_add("java.boot.class.path", _Jv_bootclasspath);
+ properties_add("sun.boot.class.path", _Jv_bootclasspath);
+ properties_add("java.class.path", _Jv_classpath);
+#endif
+
+ /* iterate over all passed options */
+
+ while ((opt = options_get(opts, vm_args)) != OPT_DONE) {
+ switch (opt) {
+ case OPT_FOO:
+ opt_foo = true;
+ break;
+
+ case OPT_IGNORE:
+ break;
+
+ case OPT_JAR:
+ opt_jar = true;
+ break;
+
+ case OPT_D32:
+#if SIZEOF_VOID_P == 8
+ puts("Running a 32-bit JVM is not supported on this platform.");
+ exit(1);
+#endif
+ break;
+
+ case OPT_D64:
+#if SIZEOF_VOID_P == 4
+ puts("Running a 64-bit JVM is not supported on this platform.");
+ exit(1);