Skip to main content
gamedev.net
🔒 Locked

[java] JNI GetObjectClass() error !!!! help!!!!

Started by Qatal 3 replies 1.8k views
Original Post
Qatal
Qatal
first a little about my project, to get things in context. it is a game engine, written in c++ (for speed, and good access to DirectX, etc) but "scriptable" using Java, in a similar way to the Unreal Engine with its unrealscript [except that unrealscript sucks hairy ass compared with true java)... I am using jdk1.2.2 [mainly because of my slow 56k connection and its 20mb smaller than the latest], J2SE. Most things seem to work fine, for example, i can call native methods, and they can call java methods back, and i can keep references to java objects as jobjects, tagged with NewLocalReference(), and all this works. However, i have noticed that when i try to call a method on a *stored* object for which i havent remembered the jclass variable, method calls suddenly start failing with the Runtime kicking me out, saying that im using an invalid method ID with the object. I have traced this a good way, and found that while i can find a class correctly using the JNI FindClass(UTFString) function, when i try to retrieve the class of an object using GetObjectClass(jobject), i get a zero result, which is clearly not a class ID. things then begin to fail because I can''t find methodIDs from a zero-class. What is wrong with: - the GetObjectClass function, or - [more likely] my code, that may be causing this? Thanks in advance. Chris Forbes
die or be died...i think
Qatal
Qatal
please?

would it perhaps be more useful if i posted the source?
die or be died...i think
Qatal
Qatal
In a vain attempt to get around the above problem by remembering
the class reference with the object reference, i discovered yet another problem - my *stored* method IDs from the same object still fail.

Yes, I am making a NewGlobalReference to the object and the class....

Is this the GC''s fault, or have i got something seriously screwy?

Thanks
Chris
die or be died...i think
Qatal
Qatal
im beginning to think that noone''s interested in helping here...
die or be died...i think

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.