JDK-6996291 : command line selection of MToolkit by -Dawt.toolkit=sun.awt.motif.MToolkit fails from jdk7 b21 on
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: OpenJDK6,6,7
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS:
    linux,linux_ubuntu,solaris,solaris_10 linux,linux_ubuntu,solaris,solaris_10
  • CPU: generic,x86,sparc
  • Submitted: 2010-10-29
  • Updated: 2016-07-03
  • Resolved: 2012-05-24
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 8
8 b17Fixed
Related Reports
Duplicate :  
Relates :  
Description
The problem may actually due to some security related changes since if set AWT_TOOLKIT environment variable to MToolkit, MToolkit works fine.

The source for the test: TestCursor.java is attached with this bug.

Here are detailed failure message:

For jdk7 b21:
/java/re/jdk/7/promoted/all/b21/binaries/solaris-i586/bin/java  -Dawt.toolkit=sun.awt.motif.MToolkit TestCursor
Exception in  thread "main" java.lang.UnsatisfiedLinkError: sun.awt.motif.MToolkit.init(Ljava/lang/String;)V
        at sun.awt.motif.MToolkit.init(Native Method)
        at sun.awt.motif.MToolkit.<init>(MToolkit.java:152)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:539)
        at java.lang.Class.newInstance0(Class.java:373)
        at java.lang.Class.newInstance(Class.java:326)
        at java.awt.Toolkit$2.run(Toolkit.java:876)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:856)
        at java.awt.Window.getToolkit(Window.java:1207)
        at java.awt.Window.init(Window.java:401)
        at java.awt.Window.<init>(Window.java:439)
        at java.awt.Frame.<init>(Frame.java:420)
        at javax.swing.JFrame.<init>(JFrame.java:225)
        at TestCursor.main(TestCursor.java:7)

For jdk7 b20:
/java/re/jdk/7/promoted/all/b20/binaries/solaris-i586/bin/java  -Dawt.toolkit=sun.awt.motif.MToolkit TestCursor
it runs fine.

For jdk7 b116, the failure message is the same as in jdk7 b21.
/java/re/jdk/7/promoted/all/b116/binaries/solaris-i586/bin/java  -Dawt.toolkit=sun.awt.motif.MToolkit TestCursor
Exception in thread "main" java.lang.UnsatisfiedLinkError: sun.awt.X11FontManager.setNativeFontPath(Ljava/lang/String;)V
        at sun.awt.X11FontManager.setNativeFontPath(Native Method)
        at sun.awt.X11FontManager.setNativeFontPath(X11FontManager.java:733)
        at sun.awt.motif.MToolkit.<clinit>(MToolkit.java:128)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:186)
        at java.awt.Toolkit$2.run(Toolkit.java:863)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:855)
        at java.awt.Window.getToolkit(Window.java:1311)
        at java.awt.Window.init(Window.java:497)
        at java.awt.Window.<init>(Window.java:533)
        at java.awt.Frame.<init>(Frame.java:420)
        at javax.swing.JFrame.<init>(JFrame.java:224)
        at TestCursor.main(TestCursor.java:7)


if set environment variable and run MToolkit, it is fine:
 AWT_TOOLKIT=MToolkit
 export AWT_TOOLKIT
echo $AWT_TOOLKIT
MToolkit
bash-3.00$ /java/re/jdk/7/promoted/all/b116/binaries/solaris-i586/bin/java TestCursor
bash-3.00$ /java/re/jdk/7/promoted/all/b21/binaries/solaris-i586/bin/java TestCursor
bash-3.00$ echo $AWT_TOOLKIT
MToolkit
bash-3.00$ /java/re/jdk/7/promoted/all/b20/binaries/solaris-i586/bin/java TestCursor

Comments
SUGGESTED FIX http://hg.openjdk.java.net/jdk8/awt/jdk/rev/28f768c41a90
14-11-2011

EVALUATION The reason why the latest JDK7 builds run fine with AWT_TOOLKIT=MToolkit is that AWT no longer pays any attention to this env variable. However, we can't ignore awt.toolkit system property as it's a part of AWT public API.
22-11-2010

EVALUATION MToolkit is no longer supported in JDK7. Although it's enough reason to close this CR as not a defect, I'd prefer leaving it's opened and correct the output, so running java -Dawt.toolkit=sun.awt.motif.MToolkit should behave the same way as java -Dawt.toolkit=some.unknown.class That is, the output should be like that: java.awt.AWTError: Toolkit not found: sun.awt.motif.MToolkit at java.awt.Toolkit$2.run(Toolkit.java:870) at java.security.AccessController.doPrivileged(Native Method) at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:855) ...
01-11-2010