Compiling OpenJDK 7 without X11

compilation, java, linux, xorg

Solution

I don't think so. AWT and Swing are fairly core Java components. Also, Headless Java mode is achieved through with an AWT option (`java.awt.headless=true`). Further, from How to Integrate with the Desktop Class -

If an application runs in an environment without a keyboard, mouse, or monitor (a "headless" environment), the `getDesktop()` method throws a `java.awt.HeadlessException`.

So it isn't as simple as compiling without X11 in Java. I believe the actual rendering is still done with X11 libraries (even when operating in headless mode).

Problem

I am trying to compile OpenJDK 7 on a headless RHEL server. I have no desire to install a bunch of miscellaneous X dependencies just to build it. Is there any way to compile OpenJDK 7 without Swing/AWT support (and hence, without the need to link against /usr/lib{arch}/X11 at build-time?

Original source

Related problems