summaryrefslogtreecommitdiff
path: root/jvmfwk
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2020-09-22 20:41:49 +0200
committerStephan Bergmann <sbergman@redhat.com>2020-09-22 21:43:56 +0200
commit7db048f62929a9d267b63db3a6ea2b58b47ec757 (patch)
treefea8daeac65b52ab3e754ef59e99c38c01bb12a1 /jvmfwk
parent218001e9f06f1cbe44abf2fbebfc360b682e432a (diff)
Manually select JDK outside /Library/Java/JavaVirtualMachines on macOS
32bc8ddbf335dd26019edcf12758643b4cff9913 "tdf#94716 allow Oracle's JDK to be used on OS X 10.10 and 10.11" had restricted both addJavaInfosDirScan (jvmfwk/plugins/sunmajor/pluginlib/util.cxx, relevant when LO scans for available Java runtimes) and JvmfwkUtil_isLoadableJVM (which is more central and also relevant when manually adding a Java installation on the Advanced options page) to JDK installations under /Library/Java/JavaVirtualMachines. Recent versions of OpenJDK for macOS are provided as *.tar.gz files (e.g., <https://download.java.net/java/GA/jdk15/779bf45e88a44cbd9ea6621d33e33db1/36/GPL /openjdk-15_osx-x64_bin.tar.gz> avaiable at <http://jdk.java.net/15/>) that can potentially be installed anywhere, so it looks useful to remove the /Library/Java/JavaVirtualMachines restriction from JvmfwkUtil_isLoadableJVM. I'm not sure whether that would have any nagative impact, esp. for any scenario that would still be relevant today. When I unpacked the above openjdk-15_osx-x64_bin.tar.gz to ~/OpenJDK/ on my macOS 10.15.6, and manually added /Users/stephan/OpenJDK/jdk-15.jdk/Contents/Home on the Advanced options page, everything appeared to work fine. Change-Id: I15545cc786a4a423f3bfe22ba477a45d6ef7fdf1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103212 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'jvmfwk')
-rw-r--r--jvmfwk/plugins/sunmajor/pluginlib/util_cocoa.mm38
1 files changed, 7 insertions, 31 deletions
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/util_cocoa.mm b/jvmfwk/plugins/sunmajor/pluginlib/util_cocoa.mm
index 136518253cde..8c745f8d98db 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/util_cocoa.mm
+++ b/jvmfwk/plugins/sunmajor/pluginlib/util_cocoa.mm
@@ -21,40 +21,16 @@ bool JvmfwkUtil_isLoadableJVM( OUString const & aURL )
NSString *pString = [NSString stringWithCharacters:reinterpret_cast<unichar const *>(aURL.getStr()) length:aURL.getLength()];
if ( pString )
{
- NSURL *pURL = nil;
-
// Ignore all but Oracle's JDK as loading Apple's Java and Oracle's
// JRE will cause macOS's JavaVM framework to display a dialog and
// invoke exit() when loaded via JNI on macOS 10.10
- NSURL *pTmpURL = [NSURL URLWithString:pString];
- if ( pTmpURL )
- pTmpURL = [pTmpURL filePathURL];
- if ( pTmpURL )
- pTmpURL = [pTmpURL URLByStandardizingPath];
- if ( pTmpURL )
- pTmpURL = [pTmpURL URLByResolvingSymlinksInPath];
- if ( pTmpURL )
- {
- NSURL *pJVMsDirURL = [NSURL URLWithString:@"file:///Library/Java/JavaVirtualMachines/"];
- if ( pJVMsDirURL )
- pJVMsDirURL= [pJVMsDirURL filePathURL];
- if ( pJVMsDirURL )
- pJVMsDirURL = [pJVMsDirURL URLByStandardizingPath];
- // The JVM directory must not contain softlinks or the JavaVM
- // framework bug will occur so don't resolve softlinks in the
- // JVM directory
- if ( pJVMsDirURL )
- {
- NSString *pTmpURLString = [pTmpURL absoluteString];
- NSString *pJVMsDirURLString = [pJVMsDirURL absoluteString];
- if ( pTmpURLString && pJVMsDirURLString && [pJVMsDirURLString length] )
- {
- NSRange aJVMsDirURLRange = [pTmpURLString rangeOfString:pJVMsDirURLString];
- if ( !aJVMsDirURLRange.location && aJVMsDirURLRange.length )
- pURL = pTmpURL;
- }
- }
- }
+ NSURL *pURL = [NSURL URLWithString:pString];
+ if ( pURL )
+ pURL = [pURL filePathURL];
+ if ( pURL )
+ pURL = [pURL URLByStandardizingPath];
+ if ( pURL )
+ pURL = [pURL URLByResolvingSymlinksInPath];
while ( pURL )
{