In java I have:
public class MyClass{
public enum STATUS {
ZERO,
ONE ,
TWO
}
public native STATUS nativeGetStatus();
I struggled with the accepted answer since I couldn't figure out the signature of the static field for a while. So here's the JNI implementation that should work with the example above (not tested):
jclass clSTATUS = env->FindClass("MyClass$STATUS");
jfieldID fidONE = env->GetStaticFieldID(clSTATUS , "ONE", "LMyClass$STATUS;");
jobject STATUS_ONE = env->GetStaticObjectField(clSTATUS, fidONE);
return STATUS_ONE;
Of course, you can do it. Enum values are public static fields of Enum class, so you can use this official manual to write the code. Just get the field from JNI and return it as jobject.