All my java applications now throw a java.awt.headlessexception

后端 未结 3 1344
猫巷女王i
猫巷女王i 2020-12-06 10:45

So a couple days ago I had several working Java applications using the Swing library, JFrame in particular. They all worked perfectly fine and now

相关标签:
3条回答
  • 2020-12-06 11:22

    Multiple Linux distros have separate packages for the base of the JRE vs the JRE GUI.

    On RHEL7/CentOS 7 for example, if you only have this package installed:

    • java-1.8.0-openjdk-headless

    You also need to install this package:

    • java-1.8.0-openjdk
    0 讨论(0)
  • 2020-12-06 11:33

    You can try to change a JRE you are currently using. Go to the "Run Configuration" of your project and change a JRE from your project's default to a Java Platform "standard" version.

    0 讨论(0)
  • 2020-12-06 11:41

    HeadlessException

    Thrown when code that is dependent on a keyboard, display, or mouse is called in an environment that does not support a keyboard, display, or mouse.

    To set up headless mode use

    java -Djava.awt.headless=true

    Using Headless Mode in the Java SE Platform

    0 讨论(0)
提交回复
热议问题