1 /* src/native/vm/gnuclasspath/gnu_classpath_VMSystemProperties.c
3 Copyright (C) 1996-2005, 2006, 2007, 2008
4 CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
6 This file is part of CACAO.
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License as
10 published by the Free Software Foundation; either version 2, or (at
11 your option) any later version.
13 This program is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
33 #include "mm/memory.h"
35 #include "native/jni.h"
36 #include "native/native.h"
38 #include "native/include/java_util_Properties.h"
40 #include "native/include/gnu_classpath_VMSystemProperties.h"
42 #include "vm/exceptions.hpp"
43 #include "vm/properties.h"
47 /* native methods implemented by this file ************************************/
49 static JNINativeMethod methods[] = {
50 { "preInit", "(Ljava/util/Properties;)V", (void *) (ptrint) &Java_gnu_classpath_VMSystemProperties_preInit },
51 { "postInit", "(Ljava/util/Properties;)V", (void *) (ptrint) &Java_gnu_classpath_VMSystemProperties_postInit },
55 /* _Jv_gnu_classpat_VMSystemProperties_init ************************************
57 Register native functions.
59 *******************************************************************************/
61 void _Jv_gnu_classpath_VMSystemProperties_init(void)
65 u = utf_new_char("gnu/classpath/VMSystemProperties");
67 native_method_register(u, methods, NATIVE_METHODS_COUNT);
72 * Class: gnu/classpath/VMSystemProperties
74 * Signature: (Ljava/util/Properties;)V
76 JNIEXPORT void JNICALL Java_gnu_classpath_VMSystemProperties_preInit(JNIEnv *env, jclass clazz, java_util_Properties *properties)
80 p = (java_handle_t *) properties;
83 exceptions_throw_nullpointerexception();
87 /* fill the java.util.Properties object */
89 properties_system_add_all(p);
94 * Class: gnu/classpath/VMSystemProperties
96 * Signature: (Ljava/util/Properties;)V
98 JNIEXPORT void JNICALL Java_gnu_classpath_VMSystemProperties_postInit(JNIEnv *env, jclass clazz, java_util_Properties *properties)
101 #if defined(ENABLE_JRE_LAYOUT)
107 p = (java_handle_t *) properties;
110 exceptions_throw_nullpointerexception();
114 /* post-set some properties */
116 #if defined(ENABLE_JRE_LAYOUT)
117 /* XXX when we do it that way, we can't set these properties on
120 java_home = properties_get("java.home");
122 properties_system_add(p, "gnu.classpath.home", java_home);
130 path = MNEW(char, len);
132 strcpy(path, "file://");
133 strcat(path, java_home);
134 strcat(path, "/lib");
136 properties_system_add(p, "gnu.classpath.home.url", path);
138 MFREE(path, char, len);
144 * These are local overrides for various environment variables in Emacs.
145 * Please do not remove this and leave it at the end of the file, where
146 * Emacs will automagically detect them.
147 * ---------------------------------------------------------------------
150 * indent-tabs-mode: t