Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Error Message

If you get the error "Could not initialize class java.awt.Toolkit" when starting a setup

Code Block
$ ./setup.sh -u
java -Dizpack.mode=privileged -jar "./joc.1.12.0.jar"
Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class java.awt.Toolkit
        at java.awt.Component.<clinit>(Component.java:593)
        at com.izforge.izpack.installer.GUIInstaller.showFatalError(Unknown Source)
        at com.izforge.izpack.installer.GUIInstaller.<init>(Unknown Source)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at java.lang.Class.newInstance(Class.java:442)
        at com.izforge.izpack.installer.Installer.main(Unknown Source)

then the Java environment misses a library.

Go into the subfolder lib/<os-arch> of the Java installation (e.g. /opt/jre8/lib/amd64) and check the library dependencies of libawt_xawt.so.

Code Block
$ ldd libawt_xawt.so
        linux-vdso.so.1 =>  (0x00007ffd307fe000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f6f42498000)
        libm.so.6 => /lib64/libm.so.6 (0x00007f6f42195000)
        libawt.so => /opt/jdk1.8.0_77/jre/lib/amd64/libawt.so (0x00007f6f41ec3000)
        libXext.so.6 => /lib64/libXext.so.6 (0x00007f6f41cb1000)
        libX11.so.6 => /lib64/libX11.so.6 (0x00007f6f41972000)
        libXrender.so.1 => /lib64/libXrender.so.1 (0x00007f6f41768000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007f6f41564000)
        libXtst.so.6 => not found
        libXi.so.6 => /lib64/libXi.so.6 (0x00007f6f4114d000)
        libjava.so => /opt/jdk1.8.0_77/jre/lib/amd64/libjava.so (0x00007f6f40f21000)
        libjvm.so => not found
        libc.so.6 => /lib64/libc.so.6 (0x00007f6f40b5f000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f6f42922000)
        libjvm.so => not found
        libxcb.so.1 => /lib64/libxcb.so.1 (0x00007f6f4093c000)
        libjvm.so => not found
        libverify.so => /opt/jdk1.8.0_77/jre/lib/amd64/libverify.so (0x00007f6f4072c000)
        libXau.so.6 => /lib64/libXau.so.6 (0x00007f6f40528000)
        libjvm.so => not found


In above example libXtst.so.6 is not found. The "not found" message for libjvm.so can be ignored.

Solution

Install the missing libraries