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?


I don't know RHEL, but usually their is an OpenJDK *-headless package in distributions that doesn't include GUI components, and normally no dependencies to X11 packages.

For instance debian provide one package and ArchLinux too

  • Correct, RHEL/CentOS/Fedora do not provide an analogue to those. – javanix May 1 '13 at 13:38
  • So, maybe looking at the ArchLinux PKGBUILD script that generates the package can give you some hints. – StreakyCobra May 1 '13 at 13:44
  • Oh, thanks - I was looking at the Debian sources and it is U-G-L-Y – javanix May 1 '13 at 13:53
  • But after a quick look at the PKGBUILD, I am not sure this will help because I suspect that they build java with the GUI, and then just copy what is needed into the -headless one. – StreakyCobra May 1 '13 at 14:08
  • Yeah, I think you are right, but this does get me a little down the path. I really feel like there have to be compile-time options floating around somewhere to do it but Oracle's stupid build infrastructure is nigh-impossible to grok. – javanix May 1 '13 at 15:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.