JDK-8212700 : Change the mechanism by which JDK loads the platform-specific AWT Toolkit
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 9,10,11
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2018-10-19
  • Updated: 2021-09-16
  • Resolved: 2019-05-10
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 13
13 b21Fixed
Related Reports
CSR :  
Duplicate :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Sub Tasks
JDK-8225358 :  
Description
It was noted that JDK uses reflection on a class name located via a system property to locate the platform-specific AWT Toolkit class :

The awt.toolkit property is read in java.awt.Toolkit.java
and will be one of :
"sun.awt.X11.XToolkit" 
"sun.lwawt.macosx.LWCToolkit"
"sun.awt.windows.WToolkit"

This requires java launcher support via the platform-specific
java_props_md.c files to set the system property later read by
java.awt.Toolkit

Similar issues have been filed for PrinterJob & GraphicsEnvironment

https://bugs.openjdk.java.net/browse/JDK-8130264 : java.awt.printerjob
https://bugs.openjdk.java.net/browse/JDK-8130266 : java.awt.graphicsenv 

It would be good to be able to eliminate that.

Comments
URL: http://hg.openjdk.java.net/jdk/jdk/rev/dde07ac16610 User: psadhukhan Date: 2019-05-15 09:11:03 +0000
15-05-2019

URL: http://hg.openjdk.java.net/jdk/client/rev/dde07ac16610 User: prr Date: 2019-05-10 23:23:59 +0000
10-05-2019

Other issues related to removing desktop module code from the launcher are : https://bugs.openjdk.java.net/browse/JDK-8212703 which removed setting of a debugging font path, and https://bugs.openjdk.java.net/browse/JDK-8222814 to remove a system property sun.desktop There is other launcher code which has knowledge of the desktop module 1) Code which pre-loads D3D on Windows for startup performance 2) Native splashscreen support, using a library that is in the desktop module. For (1) you could remove it and forgo the performance, but for (2) I don't see what to do since the whole point is to get that splashscreen displayed from the launcher, asap, before the VM starts.
22-04-2019

The above MacOS code is related to selecting the headless toolkit and is covered by https://bugs.openjdk.java.net/browse/JDK-8222819
22-04-2019

See the discussion here : http://mail.openjdk.java.net/pipermail/awt-dev/2018-October/014469.html and note there is also some Mac-specific support to consider > awt.headless: This may need native code specific to the Mac. > isInAquaSession() ? NULL :"true";
19-10-2018