Selecting an AWT mode
There are two modes available when using AWT: normal and headless. One factor in choosing which mode to use is whether you will need to use heavyweight AWT components.
Normal Mode
Normal mode must be used if your application uses the Java™ AWT API to display windows, frames, dialog boxes, or similar heavyweight components. Use normal mode if you expect your application to receive mouse operation events or keyboard input. Normal mode is the default mode and nothing needs to be specified to enable it.
Headless mode
Headless mode can be used if your Java application does not interact directly with a user. This means that your Java application does not display windows or dialog boxes, does not accept keyboard or mouse input, and does not use any heavyweight AWT components. This mode is selected by specifying Java property java.awt.headless=true on the Java invocation. By using headless mode, you avoid the need for a VNC/X-server.
- Servlets or other server based programs that only use the AWT API to create images to be included in a data stream returned to a remote user
- Any program that only creates or manipulates images or image files without actually displaying them using heavyweight AWT components
The default value for the Java property java.awt.headless is false.
Heavyweight AWT components
Heavyweight AWT components | |||
---|---|---|---|
Applet | Frame | List | Robot |
Button | JApplet | Menu | Scrollbar |
Checkbox | JDialog | MenuBar | ScrollPane |
Choice | JFrame | MenuComponent | TextArea |
Dialog | JWindow | MenuItem | TextComponent |
FileDialog | Label | PopupMenu | Window |