summaryrefslogtreecommitdiff
path: root/stoc
diff options
context:
space:
mode:
authorChristof Pintaske <cp@openoffice.org>2002-01-20 19:11:04 +0000
committerChristof Pintaske <cp@openoffice.org>2002-01-20 19:11:04 +0000
commit71eafcb210012761a40c927eb3f2f442af816bc9 (patch)
treeddd38e5be29871899d6f4cb0fa5475254326f438 /stoc
parent27fae383655a97ee66091a26260930213b6ce5cb (diff)
#96239# added support for JAVA_HOME
Diffstat (limited to 'stoc')
-rw-r--r--stoc/source/javavm/javavm.cxx18
-rw-r--r--stoc/source/javavm/jvmargs.cxx17
-rw-r--r--stoc/source/javavm/jvmargs.hxx10
3 files changed, 38 insertions, 7 deletions
diff --git a/stoc/source/javavm/javavm.cxx b/stoc/source/javavm/javavm.cxx
index a6b050778e46..d5e39692a8f0 100644
--- a/stoc/source/javavm/javavm.cxx
+++ b/stoc/source/javavm/javavm.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: javavm.cxx,v $
*
- * $Revision: 1.26 $
+ * $Revision: 1.27 $
*
- * last change: $Author: jl $ $Date: 2001-11-22 13:17:57 $
+ * last change: $Author: cp $ $Date: 2002-01-20 20:11:04 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -1221,6 +1221,20 @@ JavaVM * JavaVirtualMachine_Impl::createJavaVM(const JVM & jvm) throw(RuntimeExc
throw RuntimeException(message, Reference<XInterface>());
}
+ #ifdef UNX
+ OUString javaHome(RTL_CONSTASCII_USTRINGPARAM("JAVA_HOME="));
+ javaHome += jvm.getJavaHome();
+ const OUString & vmType = jvm.getVMType();
+
+ if(!vmType.equals(OUString(RTL_CONSTASCII_USTRINGPARAM("jre"))))
+ {
+ javaHome += OUString(RTL_CONSTASCII_USTRINGPARAM("/jre"));
+ }
+
+ OString osJavaHome = OUStringToOString(javaHome, osl_getThreadTextEncoding());
+ putenv(strdup(osJavaHome.getStr()));
+ #endif
+
JNI_InitArgs_Type * initArgs = (JNI_InitArgs_Type *)_javaLib.getSymbol(OUString::createFromAscii("JNI_GetDefaultJavaVMInitArgs"));
JNI_CreateVM_Type * pCreateJavaVM = (JNI_CreateVM_Type *)_javaLib.getSymbol(OUString::createFromAscii("JNI_CreateJavaVM"));
if (!initArgs || !pCreateJavaVM) {
diff --git a/stoc/source/javavm/jvmargs.cxx b/stoc/source/javavm/jvmargs.cxx
index 017ed1eb8d06..552dbe618171 100644
--- a/stoc/source/javavm/jvmargs.cxx
+++ b/stoc/source/javavm/jvmargs.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: jvmargs.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: dbo $ $Date: 2001-11-07 12:51:18 $
+ * last change: $Author: cp $ $Date: 2002-01-20 20:11:04 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -118,7 +118,10 @@ namespace stoc_javavm {
;
else if(left.equals(OUString(RTL_CONSTASCII_USTRINGPARAM("Home"))))
- ;
+ _java_home = right;
+
+ else if(left.equals(OUString(RTL_CONSTASCII_USTRINGPARAM("VMType"))))
+ _vmtype = right;
else if(left.equals(OUString(RTL_CONSTASCII_USTRINGPARAM("SystemClasspath"))))
setSystemClasspath(right);
@@ -336,4 +339,12 @@ namespace stoc_javavm {
{
return _props;
}
+
+ const OUString& JVM::getJavaHome() const throw() {
+ return _java_home;
+ }
+
+ const OUString& JVM::getVMType() const throw() {
+ return _vmtype;
+ }
}
diff --git a/stoc/source/javavm/jvmargs.hxx b/stoc/source/javavm/jvmargs.hxx
index 79c97572ce89..88a3fc12dba1 100644
--- a/stoc/source/javavm/jvmargs.hxx
+++ b/stoc/source/javavm/jvmargs.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: jvmargs.hxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: jl $ $Date: 2001-10-17 15:52:51 $
+ * last change: $Author: cp $ $Date: 2002-01-20 20:11:04 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -130,6 +130,9 @@ namespace stoc_javavm {
sal_Bool _is_abort;
JNIabort _abort;
+ ::rtl::OUString _java_home;
+ ::rtl::OUString _vmtype;
+
public:
JVM() throw();
@@ -158,6 +161,9 @@ namespace stoc_javavm {
const ::rtl::OUString & getRuntimeLib() const throw();
sal_Bool isEnabled() const throw();
const ::std::vector< ::rtl::OUString> & getProperties() const;
+
+ const ::rtl::OUString & getJavaHome() const throw();
+ const ::rtl::OUString & getVMType() const throw();
};
}