2

Running the executable file (.sh) from terminal gives this output

[akash@fedora Downloads]$ ./JDownloader2Setup_unix_nojre.sh
Starting Installer ...
java.lang.NoClassDefFoundError: Could not initialize class java.awt.Toolkit
    at java.desktop/java.awt.Color.<clinit>(Color.java:277)
    at com.install4j.runtime.installer.frontend.GUIHelper.<clinit>(GUIHelper.java:46)
    at com.install4j.runtime.installer.helper.InstallerUtil.reportException(InstallerUtil.java:1327)
    at com.install4j.runtime.installer.Installer.main(Installer.java:48)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at com.exe4j.runtime.LauncherEngine.launch(LauncherEngine.java:84)
    at com.install4j.runtime.launcher.UnixLauncher.start(UnixLauncher.java:69)
    at install4j.Installer378667612.main(Unknown Source)

I don't know if there is any other output I have to send since I am still pretty new to Linux.


If anyone else got same error. Just remove your JRE/JDK and install it again.

Note- It might remove some other apps like libreoffice and stuff, so save files and make backups.

Ace
  • 21
  • 2
  • 1
    _"Could not initialize class java.awt.Toolkit"_ indicates you're running in a headless/non-graphic environment, while this installer - judging by the stacktrace - tries to launch a GUI. – Mark Rotteveel Aug 02 '22 at 07:37
  • Are you currently using the headless version of JRE/JDK (e.g. `java-11-openjdk-headless` instead of `java-11-openjdk`) before? AWT itself is a Java GUI component which cannot always be run in headless mode. – Shift and Shiftine Aug 02 '22 at 07:41
  • I dont think so using `java -version` it gives this output `openjdk version "17.0.4" 2022-07-19 OpenJDK Runtime Environment (Red_Hat-17.0.4.0.8-1.fc36) (build 17.0.4+8) OpenJDK 64-Bit Server VM (Red_Hat-17.0.4.0.8-1.fc36) (build 17.0.4+8, mixed mode, sharing)` or if it is can you share the correct command to get normal JDK version – Ace Aug 02 '22 at 08:49
  • A headless JRE is also able to use java.awt.Color, it just cannot display any windows. In this case, the stacktrace shows that it's not a headless JRE, because Color:277 will not be executed in headless mode. It looks like the JRE is somehow broken. – Ingo Kegel Aug 02 '22 at 10:54
  • 1
    So as Ingo said, it was my JRE being broken. I removed my old version and installed OpenJDK 18 and it worked now. So thanks @IngoKegel and everyone. – Ace Aug 02 '22 at 16:04

0 Answers0