java-decompiler / jd-gui

A standalone Java Decompiler GUI
GNU General Public License v3.0
14.13k stars 2.4k forks source link

ERROR launching 'JD-GUI' on MacOS #391

Open qyzhaojinxi opened 2 years ago

qyzhaojinxi commented 2 years ago

JD-GUI.app doesn't start on MacOS. jar fille can start but show nothing when open.

ERROR launching 'JD-GUI'

No suitable Java version found on your system! This program requires Java 1.8+ Make sure you install the required Java version.

jonesmith518 commented 2 years ago

try open it in terminal like : open /Applications/JD-GUI.app

qyzhaojinxi commented 2 years ago
QQ20220422-134216@2x
jonesmith518 commented 2 years ago

what's the result of the following command: java -version echo $JAVA_HOME whereis java if no result, then jdk/jre is needed , try download from oracle website and install the pkg

ate47 commented 2 years ago

I was having the same issue like 10min ago, my Java home was set to Java 17, I've set it on a Java 11 installation, open it again and it fixed it.

You can get you Java installations with /usr/libexec/java_home -V.

qyzhaojinxi commented 2 years ago

java -version:

openjdk version "17.0.1" 2021-10-19
OpenJDK Runtime Environment (build 17.0.1+12-39)
OpenJDK 64-Bit Server VM (build 17.0.1+12-39, mixed mode, sharing)

echo $JAVA_HOME: no result

whereis java:

java: /usr/bin/java
FlintyLemming commented 2 years ago

Use following command to launch it manually java -jar /Applications/JD-GUI.app/Contents/Resources/Java/jd-gui-1.6.6-min.jar

muthuraj57 commented 2 years ago

Thanks @FlintyLemming I added this in Script Editor and exported it as an Application, to launch it easily through Spotlight. do shell script "java -jar /Applications/JD-GUI.app/Contents/Resources/Java/jd-gui-1.6.6-min.jar"

eliu commented 2 years ago

maybe this link help you find why you got this error and workaround: https://sebastien.andrivet.com/fr/posts/jd-gui-macos/

and this is the cause:

$ /usr/libexec/java_home -F -v 1.8+
The operation couldn’t be completed. Unable to locate a Java Runtime that supports (null).
Please visit http://www.java.com for information on installing Java.
viquu commented 2 years ago

maybe this link help you find why you got this error and workaround: https://sebastien.andrivet.com/fr/posts/jd-gui-macos/

and this is the cause:

$ /usr/libexec/java_home -F -v 1.8+
The operation couldn’t be completed. Unable to locate a Java Runtime that supports (null).
Please visit http://www.java.com for information on installing Java.

great. i modify the Info.plist, then jd-gui is work.

jonesmith518 commented 2 years ago

maybe this link help you find why you got this error and workaround: https://sebastien.andrivet.com/fr/posts/jd-gui-macos/ and this is the cause:

$ /usr/libexec/java_home -F -v 1.8+
The operation couldn’t be completed. Unable to locate a Java Runtime that supports (null).
Please visit http://www.java.com for information on installing Java.

great. i modify the Info.plist, then jd-gui is work.

@viquu hey, thanks for the hint, and finally opened successfully by modify the Info.plist : change the key: JavaX->JVMVersion from 1.8+ to 1.8

fade03 commented 2 years ago

maybe this link help you find why you got this error and workaround: https://sebastien.andrivet.com/fr/posts/jd-gui-macos/

and this is the cause:

$ /usr/libexec/java_home -F -v 1.8+
The operation couldn’t be completed. Unable to locate a Java Runtime that supports (null).
Please visit http://www.java.com for information on installing Java.

Great!!

ChronosSong commented 2 years ago

I change /usr/libexec/java_home -F -v to /usr/libexec/java_home -F -V it ran successfully

231         if /usr/libexec/java_home -F -V ${JVMVersion}; then
232                 JAVACMD="`/usr/libexec/java_home -F -V ${JVMVersion} 2> /dev/null`/bin/java"
shrugalic commented 1 year ago

Use following command to launch it manually java -jar /Applications/JD-GUI.app/Contents/Resources/Java/jd-gui-1.6.6-min.jar

This worked for me, but I only found this after editing /Applications/JD-GUI.app/Contents/MacOS/universalJavaApplicationStub.sh to add the following on line 224, which also worked fine:

JAVA_HOME=`/usr/libexec/java_home -v 11`

I have multiple Java versions installed, but GD-GUI did not launch with 1.8 nor 17 version in the above file. (You can run /usr/libexec/java_home -V in a Shell to list all installed Java versions)

The quoted method is nicer though, because it shows that JD GUI is not compatible with Java 17 class Files in the Shell it launched in, even when a Java 17 is used to launch it.

garstini commented 1 year ago

i have solved this problem. Macosx doesn't understand version 1.8+. Therefore, i will have to change version java from "1.8"+ to "1.8" in file Info.plist. image

deadlove commented 1 year ago

Use following command to launch it manually java -jar /Applications/JD-GUI.app/Contents/Resources/Java/jd-gui-1.6.6-min.jar

This worked for me, but I only found this after editing /Applications/JD-GUI.app/Contents/MacOS/universalJavaApplicationStub.sh to add the following on line 224, which also worked fine:

JAVA_HOME=`/usr/libexec/java_home -v 11`

I have multiple Java versions installed, but GD-GUI did not launch with 1.8 nor 17 version in the above file. (You can run /usr/libexec/java_home -V in a Shell to list all installed Java versions)

The quoted method is nicer though, because it shows that JD GUI is not compatible with Java 17 class Files in the Shell it launched in, even when a Java 17 is used to launch it.

yes, jdk17 is my default java, and it does not work. So using your way, it works fine

hbprotoss commented 11 months ago

i have solved this problem. Macosx doesn't understand version 1.8+. Therefore, i will have to change version java from "1.8"+ to "1.8" in file Info.plist. image

you saved my time

CarlesLlobet commented 5 months ago

i have solved this problem. Macosx doesn't understand version 1.8+. Therefore, i will have to change version java from "1.8"+ to "1.8" in file Info.plist. image

This is the best solution by far!! Thanks 0xcopv 🚀

cruzluna commented 2 weeks ago

i have solved this problem. Macosx doesn't understand version 1.8+. Therefore, i will have to change version java from "1.8"+ to "1.8" in file Info.plist. image

For those curious where the Info.plist is located image