Plans are afoot to have Java 9 accommodate the GTK 3 GUI toolkit on Linux systems. The move would bring Java current with the latest version of the toolkit and prevent application failure due to mixing of versions.
The intention, according to a Java enhancement proposal on openjdk.net, would be to support GTK (GIMP Toolkit) 2 by default, with GTK 3 used when indicated by a system property. Java graphical applications based on JavaFX, Swing, or AWT (Advanced Window Toolkit) would be accommodated under the plan, and existing applications could run on Linux without modification with either GTK 2 or 3.
The proposal was sent to the openjfx-dev mailing list by Oracle's Mark Reinhold, chief architect of the Java platform group at the company, which oversees Java's development. Java 9 is expected to be available in March 2017.
"There are a number of Java packages that use GTK. These include AWT/Swing, JavaFX, and SWT. SWT has migrated to GTK 3, though there is a system property that can be used to force it to use the older version," the proposal states. "This mixing of packages using different GTK versions causes application failures."
The issue particularly affects applications when using the Eclipse development platform. The proposal also notes that while GTK 2 and 3 are now available by default on Linux distributions, this may not always be the case.
Also identified as GTK+, the cross-platform toolkit features widgets and an API and is offered as free software via the GNU Project. It has been used in projects ranging from the Apache OpenOffice office software suite to the Inkscape vector graphics editor to the PyShare image uploader.
An alternative to backing both GTK 2 and 3, according to the Java proposal, would be to migrate Java graphics to support only GTK 3, thus reducing efforts required in porting and testing. But this plan could result in a higher number of bugs not detected by testing, require additional effort with the AWT look and feel, and necessitate both or neither of JavaFX/Swing being ported. Such a port also would require more coordination between AWT and Swing.
But a former Java official at Sun Microsystems questioned the demand for this improvement to Java. "I've not seen very many Java-based desktop applications on Linux, so not sure how big a market this is addressing,” said Arun Gupta, vice president of developer advocacy at Couchbase and a former member of the Java EE team at Sun.
This story, "Java 9 to address GTK GUI pains on Linux" was originally published by InfoWorld.