Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-7141790

[macosx] Can't start AWT when running from JavaAppLauncher and using StartOnFirstThread

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P4 P4
    • None
    • 7
    • deploy

      Migrated from http://java.net/jira/browse/MACOSX_PORT-788

      Submitted 23/Jan/12 09:30 PM by transparentech:


      When running an app (SWT based) from the JavaAppLauncher project, and using the StartOnFirstThread in the info.plist, I get the following error when trying the access AWT:

      2012-01-23 22:11:27.102 MyCoolApp[11728:707] Cocoa AWT: Apple AWT Java VM was loaded on first thread – can't start AWT. (
      0 liblwawt.dylib 0x000000013310de6d JNI_OnLoad + 468
      1 libjava.dylib 0x000000010071d165 Java_java_lang_ClassLoader_00024NativeLibrary_load + 207
      2 ??? 0x0000000102a79d85 0x0 + 4339506565
      3 ??? 0x0000000102a6e158 0x0 + 4339458392
      4 ??? 0x0000000102a6e450 0x0 + 4339459152
      )
      [LaunchRunner Error] Java7Test.main(String[]) threw an exception:
      java.lang.InternalError: Can't start the AWT because Java was started on the first thread. Make sure StartOnFirstThread is not specified in your application's Info.plist or on the command line
      at java.lang.ClassLoader$NativeLibrary.load(Native Method)
      at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1940)
      at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1825)
      at java.lang.Runtime.load0(Runtime.java:792)
      at java.lang.System.load(System.java:1059)
      at java.lang.ClassLoader$NativeLibrary.load(Native Method)
      at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1940)
      at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1846)
      at java.lang.Runtime.loadLibrary0(Runtime.java:845)
      at java.lang.System.loadLibrary(System.java:1084)
      at sun.security.action.LoadLibraryAction.run(LoadLibraryAction.java:67)
      at sun.security.action.LoadLibraryAction.run(LoadLibraryAction.java:47)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.awt.Toolkit.loadLibraries(Toolkit.java:1648)
      at java.awt.Toolkit.<clinit>(Toolkit.java:1670)
      at javax.swing.UIManager.getSystemLookAndFeelClassName(UIManager.java:607)
      at javax.swing.UIManager$1.run(UIManager.java:1228)
      at java.security.AccessController.doPrivileged(Native Method)
      at javax.swing.UIManager.loadSwingProperties(UIManager.java:1223)
      at javax.swing.UIManager.initialize(UIManager.java:1430)
      at javax.swing.UIManager.maybeInitialize(UIManager.java:1420)
      at javax.swing.UIManager.getDefaults(UIManager.java:655)
      at javax.swing.UIManager.getColor(UIManager.java:697)
      at Java7Test$1.widgetSelected(Java7Test.java:30)
      at org.eclipse.swt.widgets.TypedListener.handleEvent(Unknown Source)
      at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source)
      at org.eclipse.swt.widgets.Display.sendEvent(Unknown Source)
      at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
      at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
      at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
      at org.eclipse.swt.widgets.Widget.notifyListeners(Unknown Source)
      at org.eclipse.swt.widgets.Display.runDeferredEvents(Unknown Source)
      at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source)
      at Java7Test.main(Java7Test.java:37)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:601)
      at apple.launcher.JavaAppLauncher.run(JavaAppLauncher.java:73)
      at apple.launcher.JavaAppLauncher.launch(JavaAppLauncher.java:48)
      JavaAppLauncherFailure CallStaticVoidMethod() threw an exception

      In my JavaAppLauncher project, I've bundled a JRE (java.runtime.version=1.7.0-u4-b225-20120121).

      I've attached the Java class I'm using as a test. Since MACOSX_PORT-784 was resolved, I can run this class using a JDK/JRE from the command line. However, with this class as the main class in the JavaAppLauncher project, I get the above exception.

      Please let me know if you need more details.

            cbensen Chris Bensen (Inactive)
            dcherepanov Dmitry Cherepanov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: