JDK-7150516 : [macosx] appletviewer shouldn't link against libX11 on the Mac
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 7u4
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: os_x
  • CPU: generic
  • Submitted: 2012-03-02
  • Updated: 2012-03-21
  • Resolved: 2012-03-19
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7 JDK 8
7u4 b16Fixed 8Fixed
Description
I noticed a problem with the jdk 7u4 build for OS X - bin/appletviewer
doesn't run. When I try to launch it, I get:

dyld: Library not loaded: /usr/X11/lib/libX11.6.dylib
Referenced from:
/Library/Java/JavaVirtualMachines/jdk1.7.0_04/demo/jfx/Java2D/../../../bin/appletviewer

Reason: Incompatible library version: appletviewer requires version
10.0.0 or later, but libX11.6.dylib provides version 9.0.0
Trace/BPT trap

bin/appletviewer worked fine in 7u4b228.

Running the appletviewer class directly ('java sun.applet.appletviewer')
does seem to work.

I saw it mentioned in MACOSX_PORT-524 that the X11 toolkit is not the
default in JDK7 on Mac. Perhaps the appletviewer executable is
requesting the X11 toolkit?

Comments
SUGGESTED FIX --- old/make/launchers/Makefile.launcher 2012-03-02 18:07:27.000000000 +0400 +++ new/make/launchers/Makefile.launcher 2012-03-02 18:07:26.000000000 +0400 @@ -159,8 +159,10 @@ # GUI tools ifeq ($(GUI_TOOL),true) ifneq ($(PLATFORM), windows) - # Anything with a GUI needs X11 to be linked in. - OTHER_LDLIBS += -L$(OPENWIN_LIB) -lX11 + ifneq ($(PLATFORM), macosx) + # Anything with a GUI needs X11 to be linked in. + OTHER_LDLIBS += -L$(OPENWIN_LIB) -lX11 + endif endif endif
02-03-2012

EVALUATION The makefile that's doing it is jdk/make/launchers/Makefile.launcher # GUI tools ifeq ($(GUI_TOOL),true) ifneq ($(PLATFORM), windows) # Anything with a GUI needs X11 to be linked in. OTHER_LDLIBS += -L$(OPENWIN_LIB) -lX11 endif endif appletviewer is considered a 'GUI tool', so it is built linked against X11. policytool is also affected by this. This is wrong -- just because we aren't building windows doesn't mean we need X11.
02-03-2012