java-decompiler / jd-gui

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

Launch failed after upgrading to macOS 11 #360

Closed gzjaychen closed 3 years ago

gzjaychen commented 3 years ago

After upgrading macOS from 10.15 to 11.3.1 (20E241)

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.

java version "1.8.0_251" Java(TM) SE Runtime Environment (build 1.8.0_251-b08) Java HotSpot(TM) 64-Bit Server VM (build 25.251-b08, mixed mode)

meb21uk commented 3 years ago

Navigate in terminal to the JD-GUI.app/contents. Open Info.plist using VI and remove the + from 1.8+. Should work now.

bric3 commented 3 years ago

If the machne don't have a JDK 1.8 but JDK 11, replace 1.8+ by 11

jeliker commented 3 years ago

I solved for my installation by getting latest universalJavaApplicationStub code from here and replacing in the app bundle: https://github.com/tofi86/universalJavaApplicationStub

gzjaychen commented 3 years ago

Navigate in terminal to the JD-GUI.app/contents. Open Info.plist using VI and remove the + from 1.8+. Should work now.

It works.

ajmas commented 3 years ago

I am a little confused with the current state of JDKs & JREs, since java.com provides 1.8.0-31, while https://www.oracle.com/java/technologies/ provides version 17.

Anyhow, after having removed the '1.8+' value in the plist I now get the following when launching from the command line, using the universalJavaApplicationStub.sh script in the bundle:

/Library/Java/JavaVirtualMachines/jdk-16.0.2.jdk/Contents/Home
Exception in thread "main" java.lang.IllegalAccessError: class org.jd.gui.OsxApp (in unnamed module @0x13545af8) cannot access class com.apple.eawt.Application (in module java.desktop) because module java.desktop does not export com.apple.eawt to unnamed module @0x13545af8
    at org.jd.gui.OsxApp.main(Unknown Source)

I suspect that jdk-16 (latest I had on my computer) and other non 1.8 numbered versions represent a different code base? Is this an Oracle JDK vs Open JDK thing?

Update reading through the script shows I can over-ride the JVM home selected via JAVA_HOME. Doing the following and trying to using the script let me launch using the appropriate version of the JVM:

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home 
bric3 commented 3 years ago

JDK 1.8 u31 is reaaaaally old, there have been many updates since then, fixing bugs ad CVEs. Aren't you referring to u311 instead ?

I suspect that jdk-16 (latest I had on my computer) and other non 1.8 numbered versions represent a different code base? Is this an Oracle JDK vs Open JDK thing?

No it's a change in the runtime that happened between JDK 8 and JDK 17. That's why the latest compatible version with JD-GUI is JDK 11.

jackzhangdev commented 2 years ago

If the machne don't have a JDK 1.8 but JDK 11, replace 1.8+ by 11

this works for me

Lorenzo45 commented 2 years ago

I couldn't get it to work but I found this alternative that works well: https://plugins.jetbrains.com/plugin/17851-jadx-android-decompiler

Boat2017 commented 2 years ago

现在是假期。已经收到您的来信,我会尽快回复。

NxsHbb commented 2 years ago

If the machne don't have a JDK 1.8 but JDK 11, replace 1.8+ by 11

Worked for me.