Muthu GM
Muthu GM

Reputation: 281

In JNI how can I access static Java variable from native code

It is possible to access static Java variable from the native language.

Upvotes: 1

Views: 758

Answers (1)

Stephen C
Stephen C

Reputation: 718788

Sure it is possible. Look at Section 4.1.3 of "The Java™ Native Interface Programmer’s Guide and Specification" by Sheng Liang .... which includes some example code.

Or the Official JNI 6.0 specification:

(I assume that you mean a static field of a Java class ... since that is the closest there is to a "global variable" in Java.)

Upvotes: 4

Related Questions