APIdia Launch Partner
Top Description Fields Constructors Methods
java.awt

public Class HeadlessException

extends UnsupportedOperationException
Class Inheritance
Imports
java.io.Serial

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. Any code that depends on any of those devices should firstly ensure their availability using the GraphicsEnvironment.isHeadless() method and throw HeadlessException if the latter returns true.
Author
Michael Martak
Since
1.4
See Also
GraphicsEnvironment#isHeadless

Field Summary

Modifier and TypeField and Description
private static final long
serialVersionUID

Hides java.lang.UnsupportedOperationException.serialVersionUID.

Use serialVersionUID from JDK 1.4 for interoperability.

Constructor Summary

AccessConstructor and Description
public
HeadlessException()

Constructs a new HeadlessException with null as its detail message.

public
HeadlessException(String
the error message
msg
)

Create a new instance with the specified detailed error message.

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

the detail message string of this HeadlessException instance (which may be null).
getMessage
()

Overrides java.lang.Throwable.getMessage.

Returns the detail message string of this HeadlessException.

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.lang.UnsupportedOperationException.serialVersionUID.

Use serialVersionUID from JDK 1.4 for interoperability.

Annotations
@Serial

Constructor Detail

HeadlessExceptionback to summary
public HeadlessException()

Constructs a new HeadlessException with null as its detail message. The default headless message may replace null in some cases, as outlined below.

For such HeadlessException the default headless error message may be auto-generated for some platforms. The text of the default headless message may depend on whether the GraphicsEnvironment is in fact headless. That is, the default headless message is both system and environmentally dependent.

HeadlessExceptionback to summary
public HeadlessException(String msg)

Create a new instance with the specified detailed error message. For some platforms the default headless error message may be added at the end of the specified message. The text of the default headless message may depend on whether the GraphicsEnvironment is in fact headless. That is, the default headless message is both system and environmentally dependent.

Parameters
msg:String

the error message

Method Detail

getMessageback to summary
public String getMessage()

Overrides java.lang.Throwable.getMessage.

Returns the detail message string of this HeadlessException. Depending on the platform the message specified in the constructor may be followed by the default headless error message. The text of the default headless message may depend on whether the GraphicsEnvironment is in fact headless. That is, the default headless message is both system and environmentally dependent.

Returns:String

the detail message string of this HeadlessException instance (which may be null).