prismmodelchecker / prism

The main development version of the PRISM model checker.
http://www.prismmodelchecker.org/
GNU General Public License v2.0
157 stars 72 forks source link

MacOS: unable to locate java runtime #208

Closed ahelwer closed 1 year ago

ahelwer commented 1 year ago

I am trying to run PRISM on MacOS but am getting the following error:

The operation couldn’t be completed. Unable to locate a Java Runtime.
Please visit http://www.java.com for information on installing Java.

./prism: line 125: /bin/java: No such file or directory
./prism: line 125: exec: /bin/java: cannot execute: No such file or directory

If I run which java I get /opt/homebrew/opt/openjdk/bin/java since I installed openjdk with homebrew. What environment variable do I need to set to get PRISM to look for Java there? It unfortunately isn't viable to use symlinks to redirect /bin/java to that location due to the MacOS system integrity protection feature.

davexparker commented 1 year ago

The prism launch script on Macs tries to locate the actual location of the java executable to avoid issues with shared libraries and symbolic links. If that is not working with your openjdk setup, you can specify its location with the environment variable PRISM_JAVA (or hard-code it in the script).

ahelwer commented 1 year ago

Thanks @davexparker! If I define PRISM_JAVA then try to run prism from the command line I now get the error java.lang.UnsatisfiedLinkError: no prism in java.library.path: ~/prism-4.7-osx64/lib

davexparker commented 1 year ago

You'll get that error if you are on a ARM-based Mac since the 4.7 binary is still built for Intel Macs. Compiling from source would fix it.

ahelwer commented 1 year ago

Thanks @davexparker, that worked great! Do you think PRISM will ever get a wayland version? I actually also noticed the FAQ says you need to use Oracle's version of Java, but it seems to work okay with Adopt OpenJDK so far.