From: jowenn Date: Sun, 5 Dec 2004 22:57:53 +0000 (+0000) Subject: prepare for loading libs/classfiles from install directory X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=c2848d923c8b91296443c90598f44913b3524d4a;p=cacao.git prepare for loading libs/classfiles from install directory --- diff --git a/src/cacao/cacao.c b/src/cacao/cacao.c index ce29c4e5d..41eae999d 100644 --- a/src/cacao/cacao.c +++ b/src/cacao/cacao.c @@ -36,7 +36,7 @@ - Calling the class loader - Running the main method - $Id: cacao.c 1657 2004-12-03 15:27:32Z twisti $ + $Id: cacao.c 1685 2004-12-05 22:57:53Z jowenn $ */ @@ -308,8 +308,8 @@ int main(int argc, char **argv) /************ Collect info from the environment ************************/ /* set an initial, minimal classpath */ - classpath = MNEW(char, 2); - strcpy(classpath, "."); + classpath = MNEW(char, strlen(INSTALL_PREFIX"/share/classpath/glibj.zip:.")+1); + strcpy(classpath,INSTALL_PREFIX"/share/classpath/glibj.zip:."); /* get classpath environment */ cp = getenv("CLASSPATH"); diff --git a/src/native/vm/VMRuntime.c b/src/native/vm/VMRuntime.c index ba11e35aa..9c85595f4 100644 --- a/src/native/vm/VMRuntime.c +++ b/src/native/vm/VMRuntime.c @@ -29,7 +29,7 @@ Changes: Joseph Wenninger Christian Thalinger - $Id: VMRuntime.c 1680 2004-12-04 12:02:08Z jowenn $ + $Id: VMRuntime.c 1685 2004-12-05 22:57:53Z jowenn $ */ @@ -446,7 +446,25 @@ JNIEXPORT void JNICALL Java_java_lang_VMRuntime_insertSystemProperties(JNIEnv *e #if defined(STATIC_CLASSPATH) insert_property(m, p, "java.library.path" , "."); #else - insert_property(m, p, "java.library.path" , getenv("LD_LIBRARY_PATH")); + { + char *libpath; + size_t libpathlen=0; + libpathlen=strlen(INSTALL_PREFIX"/lib/classpath")+1; + if (getenv("CACAO_LIB_OVERRIDE")) libpathlen=libpathlen+strlen(getenv("CACAO_LIB_OVERRIDE"))+1; + if (getenv("LD_LIBRARY_PATH")) libpathlen=libpathlen+strlen(getenv("LD_LIBRARY_PATH"))+1; + libpath=(char*)malloc(libpathlen); + libpath[0]=0; + if (getenv("CACAO_LIB_OVERRIDE")) { + strcat(libpath,getenv("CACAO_LIB_OVERRIDE")); + strcat(libpath,":"); + } + strcat(libpath,INSTALL_PREFIX"/lib/classpath"); + if (getenv("LD_LIBRARAY_PATH")) { + strcat(libpath,":"); + strcat(libpath,getenv("LD_LIBRARY_PATH")); + } + insert_property(m, p, "java.library.path" , libpath); + } #endif insert_property(m, p, "java.io.tmpdir", "/tmp"); insert_property(m, p, "java.compiler", "cacao.jit");