Score:0

java.lang.NoClassDefFoundError: Could not initialize class java.awt.Container

ae flag

I am pretty new to Ubuntu and also new to this forum. Looking for some help.

I've been trying to install Impro-Visor by downloading the Impro-Visor_unix_10_2.sh file and running that in a terminal.

I then get the following error message:

Starting Installer ...
java.lang.NoClassDefFoundError: Could not initialize class java.awt.Container
    at com.install4j.runtime.installer.frontend.headless.AbstractHeadlessScreenExecutor.init(Unknown Source)
 ..... 
Could not display the GUI. This application needs access to an X Server.
*******************************************************************
You can also run this application in console mode without
access to an X server by passing the argument -c
*******************************************************************

I tried:

  • Reinstalling Java
  • Installing different Java versions
  • xhost +local: which was a tip I found on the Internet

None of that changed the behavior. If I do use the -c option the script runs fine and Impro-Visor does get installed. However, it doesn't launch. The error log says:

java.lang.UnsatisfiedLinkError: Can't load library: /usr/lib/jvm/java-16-openjdk-amd64/lib/libawt_xawt.so

Does anybody know how I can solve this?
Many thanks for good tips.

aq flag
Which ubuntu? Sounds like you are running wayland and not X
UserS avatar
ae flag
Thanks. I am using version 20.04 lts desktop. Not sure what wayland and x mean? How could I check?
aq flag
https://askubuntu.com/questions/904940/how-can-i-tell-if-i-am-running-wayland
UserS avatar
ae flag
Typing echo $XDG_SESSION_TYPE gives x11
aq flag
That is X, so that was not the issue. Does the file `/usr/lib/jvm/java-16-openjdk-amd64/lib/libawt_xawt.so` exist? Does that path exist?
UserS avatar
ae flag
That file does not exist actually. I do have libawt.so and libawt_headless.so in that location but not libawt_xawt.so. I checked JAVA_HOME (which was empty) and PATH (which didn't contain JAVA_HOME) and then added /usr/lib/jvm/java-16-openjdk-amd64/lib to both. Didn't solve the problem. Is the missing file the issue? Did I do something wrong when installing java? Thanks.
aq flag
The missing file is probably the issue. Did you manually install Java 16? I have java 11 on mine and the libawt_xawt.so file is present. There is a similar question here that suggests that you have the headless version installed https://stackoverflow.com/questions/67391845/exception-java-lang-unsatisfiedlinkerror-when-trying-to-open-allure-reports-in-w#comment119119464_67391949
UserS avatar
ae flag
Ok - that narrowed it down. I reinstalled Java using inline `sudo apt-get update` inline `sudo apt-get upgrade` and then inline `sudo apt-get install openjdk-16-jdk`. Now it works fine. No clue what I did different the first time I installed java but the issue is gone. Thanks a lot for helping me out. Really appreciated.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.