exist icon indicating copy to clipboard operation
exist copied to clipboard

[Troubleshooting]: vanilla homebrew installation with opnJDK 18 fails to start

Open mischwartz23 opened this issue 2 years ago • 8 comments

:balloon: First off, thank you for contributing to eXist-db's documentation. :balloon:

Describe the problem

Troubleshooting: Running eXist-db with openjdk on a Mac. Vanilla installation (via brew) leads to a pop-up error that Java 8 must be installed.

Please provide the following

  • exist-db version: 6.0.1
  • documentation version: 6.0.1

TL;DR: I found that modification of the Info.plist and linking the openjdk to the PlugIns resolved the problem.

Modification of the Info.plist

This file is located at /Application/exist-db.app/Contents/Info.plist

The modification is to add two lines to the file, just above the JVMOptions entry:

<key>JVMRuntime</key>
<string>openjdk</string>

This provides the identifier for the JVMRuntime, and will be the link source name in the PlugIns subdirectory.

Linking the openjdk to the PlugIns subdirectory

Change directories to /Applications/exist-db.app/Contents/PlugIns

Find the relatively stable value for your openjdk installation. For me, this is in my /Library/Java/JavaVirtualMachines/openjdk.jdk link. It may be different for your installation (e.g., /usr/local/opt/openjdk/libexec/openjdk.jdk)

Assuming the directory for your jdk is as above, execute the command

ln -s /Library/Java/JavaVirtualMachines/openjdk.jdk openjdk

You should be able to launch the application normally at this point.

Reference: Original idea was found in stackexchange

mischwartz23 avatar Mar 30 '22 19:03 mischwartz23

Thanks for opening your first issue here!

welcome[bot] avatar Mar 30 '22 19:03 welcome[bot]

Could you tell us the Java version of the openJDK in question. Are you seeing this on intel or M1 macOS?

In case it’s the latter could thus be your issue https://github.com/eXist-db/exist/issues/4229

duncdrum avatar Mar 30 '22 19:03 duncdrum

This issue also existed in the previous release (5.4.1), but I didn't know how to resolve it then.

Current openjdk version used is 18.

The Mac installed on is an Intel 8-core Xeon W.

Mac OS version 12.3 (Monterey), though I believe this challenge has been around since Big Sur.

I did not dive into source code to see how the Info.plist is used to test the availability of Java on the Mac. I believe this is ultimately where the source of the problem is.

The code has always run by alternate launch strategies: (e.g., in 5.4.1, using java -Dexist.home=/Applications/eXist-db.app/Contents/Resources/eXist-db -jar Contents/Java/start.jar [now exist-start-6.0.1.jar])

Cautionary note: The particular installation I am reporting was generated by brew, not .dmg installation. My reason for posting is that it is likely others will encounter this problem. I like exist-db too much to have anyone abandon it because of installation problems.

mischwartz23 avatar Mar 30 '22 23:03 mischwartz23

@mischwartz23 that is very kind of you. I m going to migrate the issue into the core repo, as it is not really related to the documentation app or its contents.

I'd like to point out that exist is currently not officially supported to run under java 18, TBH i m quite surprised that it does run at all. AFAIK homebrew is still using the .dmg installer to do its thing.

duncdrum avatar Mar 31 '22 08:03 duncdrum

Indeed, Homebrew specifies Java 8:

exist-db requires Java 8. You can install it with:

brew install --cask homebrew/cask-versions/temurin8

See also https://github.com/eXist-db/exist/issues/3375. I assume Java 18 would suffer from the same issue.

joewiz avatar Mar 31 '22 12:03 joewiz

I think/know there are a lot of (potential) issues with Java18, as discussed, we need to change code in order to be able run eXist-db on newer versions of Java.

So no warranty, and IMO yet no support for other Runtimes that Java8 and Java11

dizzzz avatar Apr 01 '22 12:04 dizzzz

Thanks for your comments. I appreciate and respect your perspectives. I would point out that the provided directions would/will work with any installation of Java, and leave it at that. Personally, I intend to install one (or maybe two) versions of Java and rely on command line flags if I require a different standard.

mischwartz23 avatar Apr 01 '22 21:04 mischwartz23

I propose to leave this issue open, so that others might find it. But to flag it as a no-fix. Once exist supports java versions beyond 12 we can revisit our official recommendation and the installer scripts. Thank you @mischwartz23 for providing the above steps

duncdrum avatar Apr 04 '22 09:04 duncdrum