I am trying to launch a Java program with a GUI front end from a C
program.
The launching, locating, and calling of methods is working fine, but
creating
a JFrame is causing an error that I cannot find enough documentation on:
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)
My C program is below. It runs on Linux, but my Mac attempts are
frustrated.
Here is the Linux compilation:
gcc
-D_REENTRANT
-I $JDK/linux
-I $JDK/linux/include
GUIdooey.c
-L $JDK/jre/lib/i386
-L $JDK/jre/lib/i386/client
-ljvm -lpthread
-o GUIdooey
Please help me translate that command to speak Mac (OS 10.4):
This is the line I have been using up to now:
gcc -framework JavaVM GUIdooey.c -o guidooey
It works for all my JNI stuff until there is an attempt to create a
JFrame (either
directly, like the following code) or indirectly (from an already-
launched Java
method).
jstring title= (*env)->NewStringUTF(env, "JFrame from C!");
if (title==NULL) bomb(1005,"JNI failed to get memory for string");
jframe = (*env)->NewObject(env,jframe_cls,mid,title);
printf("jframe created\n");
return 0;
}
The result is that the "found constructor" message AND the "jframe
created"
message both appear, but in BETWEEN them is a long exception traceback.
sj
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden