J
jerranschmidt
Hi all,
Im wrapping some Java code in C++, i have the JVM running fine with the
correct version (1.5.0_08).
The problem comes when i call the Toolkit.getDefaultToolkit(). If i run
the java code with a test harness it runs perfect, however when i do it
with JNI it seems to just exit the function when it hits this line.
It doesnt actually return a value (not even NULL), it just terminates.
//Java
----------8<-----------
public Image getImage( String filename, byte[] imageBytes )
{
Image myToolkit = Toolkit.getDefaultToolkit().createImage( imageBytes,
0, imageBytes.length );
return myToolkit;
}
----------8<-----------
The int methods execute correctly even when the ObjectMethod
terminates.
//C++
----------8<-----------
jobject pixelBufferObject = jniEnv->CallObjectMethod( jLoadImage,
imageLoadMethodID, jstr );
int height = jniEnv->CallIntMethod( jLoadImage, getSizeYMethodID, NULL
);
int width = jniEnv->CallIntMethod( jLoadImage, getSizeXMethodID, NULL
);
----------8<-----------
Whats more is that i get no errors in compiling, linking or runtime.
I assume that the Toolkit is trying to access some sort of native
library but is not being allowed to because of the JVM for some reason.
The Java is compiled but not packaged (ie .class files not jars).
Anyone got any idea?!
Cheers!
-J
Im wrapping some Java code in C++, i have the JVM running fine with the
correct version (1.5.0_08).
The problem comes when i call the Toolkit.getDefaultToolkit(). If i run
the java code with a test harness it runs perfect, however when i do it
with JNI it seems to just exit the function when it hits this line.
It doesnt actually return a value (not even NULL), it just terminates.
//Java
----------8<-----------
public Image getImage( String filename, byte[] imageBytes )
{
Image myToolkit = Toolkit.getDefaultToolkit().createImage( imageBytes,
0, imageBytes.length );
return myToolkit;
}
----------8<-----------
The int methods execute correctly even when the ObjectMethod
terminates.
//C++
----------8<-----------
jobject pixelBufferObject = jniEnv->CallObjectMethod( jLoadImage,
imageLoadMethodID, jstr );
int height = jniEnv->CallIntMethod( jLoadImage, getSizeYMethodID, NULL
);
int width = jniEnv->CallIntMethod( jLoadImage, getSizeXMethodID, NULL
);
----------8<-----------
Whats more is that i get no errors in compiling, linking or runtime.
I assume that the Toolkit is trying to access some sort of native
library but is not being allowed to because of the JVM for some reason.
The Java is compiled but not packaged (ie .class files not jars).
Anyone got any idea?!
Cheers!
-J