H
HenStepper
I get an unhandled native exception when trying to create a JFrame from
C via JNI.
The error message is unhelpful and untraceable even on Google.
Here is the Java line it claims to bomb on:
JFrame frame = new JFrame("test frame");
Here is the result:
JavaAWT: NSException not handled by native method. Passing to Java.
java.lang.RuntimeException: Non-Java exception raised, not handled!
(Original problem: Error (1002) creating CGSWindow)
at apple.awt.OSXOffScreenSurfaceData._copyNSImagePixels(Native Method)
at
apple.awt.OSXOffScreenSurfaceData.copyNSImagePixels(OSXOffScreenSurfaceData.java:1017)
at apple.awt.CImage.createImage(CImage.java:47)
at apple.laf.AquaImageFactory.makeAlertIcon(AquaImageFactory.java:111)
at
apple.laf.AquaImageFactory.getConfirmImageIcon(AquaImageFactory.java:92)
at
apple.laf.AquaLookAndFeel.initComponentDefaults(AquaLookAndFeel.java:616)
at apple.laf.AquaLookAndFeel.getDefaults(AquaLookAndFeel.java:360)
at javax.swing.UIManager.setLookAndFeel(UIManager.java:445)
at javax.swing.UIManager.setLookAndFeel(UIManager.java:485)
at javax.swing.UIManager.initializeDefaultLAF(UIManager.java:1178)
at javax.swing.UIManager.initialize(UIManager.java:1265)
at javax.swing.UIManager.maybeInitialize(UIManager.java:1253)
at javax.swing.UIManager.getUI(UIManager.java:859)
at javax.swing.JPanel.updateUI(JPanel.java:104)
at javax.swing.JPanel.<init>(JPanel.java:64)
at javax.swing.JPanel.<init>(JPanel.java:87)
at javax.swing.JPanel.<init>(JPanel.java:95)
at javax.swing.JRootPane.createGlassPane(JRootPane.java:482)
at javax.swing.JRootPane.<init>(JRootPane.java:313)
at javax.swing.JFrame.createRootPane(JFrame.java:247)
at javax.swing.JFrame.frameInit(JFrame.java:228)
at javax.swing.JFrame.<init>(JFrame.java:195)
at GUIApp.startup(GUIApp.java:8)
startup displaying message
Apparently there is an error when native C calls Java which in turn
calls a native method _copyNSImagePixels. When I start the same class
using "java" on the command line, everything works fine.
So why is _copyNSImagePixels sensitive to the origin of this request?
An extra oddity is that line 8 in GUIApp.java is indeed the JFrame
constructor
(as the traceback shows), but line 9 is a print statement:
System.out.println("startup displaying message");
and you can see that its output arrived too. I cannot interpret this.
Does anyone know what this means?
Or, more to the point...
Does anyone know how to start a GUI from C?
TIA,
hs
C via JNI.
The error message is unhelpful and untraceable even on Google.
Here is the Java line it claims to bomb on:
JFrame frame = new JFrame("test frame");
Here is the result:
JavaAWT: NSException not handled by native method. Passing to Java.
java.lang.RuntimeException: Non-Java exception raised, not handled!
(Original problem: Error (1002) creating CGSWindow)
at apple.awt.OSXOffScreenSurfaceData._copyNSImagePixels(Native Method)
at
apple.awt.OSXOffScreenSurfaceData.copyNSImagePixels(OSXOffScreenSurfaceData.java:1017)
at apple.awt.CImage.createImage(CImage.java:47)
at apple.laf.AquaImageFactory.makeAlertIcon(AquaImageFactory.java:111)
at
apple.laf.AquaImageFactory.getConfirmImageIcon(AquaImageFactory.java:92)
at
apple.laf.AquaLookAndFeel.initComponentDefaults(AquaLookAndFeel.java:616)
at apple.laf.AquaLookAndFeel.getDefaults(AquaLookAndFeel.java:360)
at javax.swing.UIManager.setLookAndFeel(UIManager.java:445)
at javax.swing.UIManager.setLookAndFeel(UIManager.java:485)
at javax.swing.UIManager.initializeDefaultLAF(UIManager.java:1178)
at javax.swing.UIManager.initialize(UIManager.java:1265)
at javax.swing.UIManager.maybeInitialize(UIManager.java:1253)
at javax.swing.UIManager.getUI(UIManager.java:859)
at javax.swing.JPanel.updateUI(JPanel.java:104)
at javax.swing.JPanel.<init>(JPanel.java:64)
at javax.swing.JPanel.<init>(JPanel.java:87)
at javax.swing.JPanel.<init>(JPanel.java:95)
at javax.swing.JRootPane.createGlassPane(JRootPane.java:482)
at javax.swing.JRootPane.<init>(JRootPane.java:313)
at javax.swing.JFrame.createRootPane(JFrame.java:247)
at javax.swing.JFrame.frameInit(JFrame.java:228)
at javax.swing.JFrame.<init>(JFrame.java:195)
at GUIApp.startup(GUIApp.java:8)
startup displaying message
Apparently there is an error when native C calls Java which in turn
calls a native method _copyNSImagePixels. When I start the same class
using "java" on the command line, everything works fine.
So why is _copyNSImagePixels sensitive to the origin of this request?
An extra oddity is that line 8 in GUIApp.java is indeed the JFrame
constructor
(as the traceback shows), but line 9 is a print statement:
System.out.println("startup displaying message");
and you can see that its output arrived too. I cannot interpret this.
Does anyone know what this means?
Or, more to the point...
Does anyone know how to start a GUI from C?
TIA,
hs