Skip to Main Content

Java HotSpot Virtual Machine

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Accessing ENUM value passed from java in JNI

843829Jul 2 2009 — edited Jul 6 2009
Hi all

I have declared a enum variable in one of the .java files as follows

enum Day
{
SUNDAY, MONDAY, TUESDAY, WEDNESDAY,
THURSDAY, FRIDAY, SATURDAY
}


Class SomeClass
{
public native void PutWeeKName(Day value);

}

(pseudo code)

Public class Main()
{
SomeClass obj = new SomeClass ();

obj. PutWeeKName (Day.SUNDAY);
obj. PutWeeKName (Day.TUESDAY);

}

In JNI code, how do I access the Day value
JNIEXPORT void JNICALL Java_MyPackage_SomeClass_ PutWeeKName
(JNIEnv *env, jobject obj, jobject value)
{
uint32 week = (uint32)value; // this does not work

}

Can any of you tell me , how to extract the values of enum in JNI

Thanks and regards
MP
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 3 2009
Added on Jul 2 2009
10 comments
7,486 views