diff options
-rw-r--r-- | stoc/source/javavm/javavm.cxx | 38 | ||||
-rw-r--r-- | stoc/source/javavm/jvmargs.cxx | 13 | ||||
-rw-r--r-- | stoc/source/javavm/jvmargs.hxx | 6 |
3 files changed, 46 insertions, 11 deletions
diff --git a/stoc/source/javavm/javavm.cxx b/stoc/source/javavm/javavm.cxx index a01f91328ba7..f7f2b9b084d6 100644 --- a/stoc/source/javavm/javavm.cxx +++ b/stoc/source/javavm/javavm.cxx @@ -2,9 +2,9 @@ * * $RCSfile: javavm.cxx,v $ * - * $Revision: 1.36 $ + * $Revision: 1.37 $ * - * last change: $Author: jl $ $Date: 2002-08-08 08:12:02 $ + * last change: $Author: jl $ $Date: 2002-08-08 10:39:53 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -1296,21 +1296,45 @@ static void initVMConfiguration(JVM * pjvm, #endif } + sal_Bool bPropsFail= sal_False; + sal_Bool bPropsFail2= sal_False; + JavaNotConfiguredException confexc; try { getJavaPropsFromConfig(&jvm, xSMgr,xCtx); } -// catch(JavaNotConfiguredException& e) -// { -// throw; -// } - catch(Exception & exception) { + catch(JavaNotConfiguredException& e) + { + confexc= e; + bPropsFail= sal_True; + } + catch(Exception & exception) + { #ifdef DEBUG OString message = OUStringToOString(exception.Message, RTL_TEXTENCODING_ASCII_US); OSL_TRACE("javavm.cxx: couldn't use configuration cause of >%s<", message.getStr()); #endif + bPropsFail2= sal_True; + } + if( bPropsFail ||bPropsFail2) + { getJavaPropsFromEnvironment(&jvm); + // at this point we have to find out if there is a classpath and runtimelib. If not + // we'll throw the exception, because Java is misconfigured and won't run. + OUString usRuntimeLib= jvm.getRuntimeLib(); + OUString usUserClasspath= jvm.getUserClasspath(); + OUString usSystemClasspath= jvm.getSystemClasspath(); + if( usRuntimeLib.getLength() == 0 + || (usUserClasspath.getLength == 0 && usSystemClasspath.getLength() == 0)) + { + if (bPropsFail) + throw confexc; + throw new JavaNotConfiguredException(OUSTR("There is neither a java.ini (or javarc) " \ + "and there are no environment variables set which " \ + "contain configuration data"), Reference<XInterface>()); + } + } try { diff --git a/stoc/source/javavm/jvmargs.cxx b/stoc/source/javavm/jvmargs.cxx index 55e2e8afca13..6caba2f37c42 100644 --- a/stoc/source/javavm/jvmargs.cxx +++ b/stoc/source/javavm/jvmargs.cxx @@ -2,9 +2,9 @@ * * $RCSfile: jvmargs.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: jbu $ $Date: 2002-04-29 14:12:14 $ + * last change: $Author: jl $ $Date: 2002-08-08 10:39:53 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -250,6 +250,10 @@ namespace stoc_javavm { _systemClasspath = buf.makeStringAndClear(); } } +OUString JVM::getSystemClasspath() +{ + return _systemClasspath; +} void JVM::addUserClasspath(const OUString & classpath) throw() { if( classpath.getLength() ) @@ -267,6 +271,11 @@ namespace stoc_javavm { } } +OUString JVM::getUserClasspath() +{ + return _userClasspath; +} + void JVM::setPrint(JNIvfprintf vfprintf) throw() { _is_print = sal_True; _print = vfprintf; diff --git a/stoc/source/javavm/jvmargs.hxx b/stoc/source/javavm/jvmargs.hxx index 747ee4bbff60..fc14c2e0152d 100644 --- a/stoc/source/javavm/jvmargs.hxx +++ b/stoc/source/javavm/jvmargs.hxx @@ -2,9 +2,9 @@ * * $RCSfile: jvmargs.hxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: jbu $ $Date: 2002-04-29 14:12:14 $ + * last change: $Author: jl $ $Date: 2002-08-08 10:39:54 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -157,7 +157,9 @@ namespace stoc_javavm { void setMaxHeapSize(jint jiSize) throw(); void setDebugPort(jint jiDebugPort) throw(); void addSystemClasspath(const ::rtl::OUString & str) throw(); + ::rtl::OUString getSystemClasspath(); void addUserClasspath(const ::rtl::OUString & str) throw(); + ::rtl::OUString getUserClasspath(); void setPrint(JNIvfprintf vfprintf) throw(); void setExit(JNIexit exit) throw(); void setAbort(JNIabort abort) throw(); |