Determining JVM bit version (32bit or 64bit) at runtime
I am a Java beginner and facing problem at JNI level. I have to load a C++ library through my JNI layer and the problem is my JNI (/JAVA) code is
same for 32bit and 64bit JVM. 2 different processes will use this code and 1 will run under 32JVM and another under 64JVM.
Hence I have to load 32bit C++ library in one process instance and 64bith C++ library in another.
I found this way to determine the JVM bit version during run time,
String jvmModel = System.getProperty("sun.arch.data.model");
but my question is, is this portable? as it appears to me it will run only in SUN JVM. If not portable what is the portable way?
Re: Determining JVM bit version (32bit or 64bit) at runtime
Note that the sun.arch.data.model property may also return unknown, so you may wish to handle this property as well. And whether this is portable - only on the systems you have compiled your JNI. What about Mac? Windows? Linux?