summaryrefslogtreecommitdiff
path: root/jvmfwk/source/framework.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'jvmfwk/source/framework.cxx')
-rw-r--r--jvmfwk/source/framework.cxx18
1 files changed, 18 insertions, 0 deletions
diff --git a/jvmfwk/source/framework.cxx b/jvmfwk/source/framework.cxx
index 32120308f932..9684e13107cb 100644
--- a/jvmfwk/source/framework.cxx
+++ b/jvmfwk/source/framework.cxx
@@ -26,6 +26,8 @@
#include <rtl/ref.hxx>
#include <rtl/ustring.hxx>
#include <osl/diagnose.h>
+#include <osl/file.hxx>
+#include <osl/process.h>
#include <osl/thread.hxx>
#include <jvmfwk/framework.hxx>
#include <vendorbase.hxx>
@@ -219,6 +221,22 @@ javaFrameworkError jfw_startVM(
}
assert(pInfo != nullptr);
+#ifdef _WIN32
+ // Alternative JREs (AdoptOpenJDK, Azul Zulu) are missing the bin/ folder in
+ // java.library.path. Somehow setting java.library.path accordingly doesn't work,
+ // but the PATH gets picked up, so add it there.
+ // Without this hack, some features don't work in alternative JREs.
+ OUString sPATH;
+ osl_getEnvironment(OUString("PATH").pData, &sPATH.pData);
+ OUString sJRELocation;
+ osl::FileBase::getSystemPathFromFileURL(pInfo->sLocation + "/bin", sJRELocation);
+ if (sPATH.isEmpty())
+ sPATH = sJRELocation;
+ else
+ sPATH = sJRELocation + OUStringChar(SAL_PATHSEPARATOR) + sPATH;
+ osl_setEnvironment(OUString("PATH").pData, sPATH.pData);
+#endif // _WIN32
+
// create JavaVMOptions array that is passed to the plugin
// it contains the classpath and all options set in the
//options dialog