Sun has a Java System property to determine the bitness of the JVM: 32 or 64:
sun.arch.data.model=32//32bitJVM
sun.arch.data.model=64//64bitJVM
You can use
System.getProperty("sun.arch.data.model")
to determine if its 32/64 from the program.
From thesun.docs:
When writing Java code, how do I distinguish between 32 and 64-bit operation?
There’s no public API that allows you to distinguish between 32 and 64-bit operation. Think of 64-bit as just another platform in the write once, run anywhere tradition. However, if you’d like to write code which is platform specific (shame on you), the system property sun.arch.data.model has the value “32”, “64”, or “unknown”.
The only good reason is if your java code is dependent upon native libraries and your code needs to determine which version (32 or 64bit) to load on startup.
Similar Posts:
- Can’t load AMD 64-bit .dll on a IA 32-bit platform [How to Solve]
- npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: want
- [Solved] Validation failed for one or more entities. See ‘EntityValidationErrors’
- [Solved] QT operate error: exited with code – 1073741515
- Caffe Error-nvcc fatal:Unsupported gpu architecture ‘compute_20’
- [Solved] Computed property “xxxx” was assigned to but it has no setter
- EasyRTC Error: “[ERR] mod_local_stream.c:880 Unknown source default” [How to Solve]
- PING[ARC2]: Heartbeat failed to connect to standby ‘gqtzdb_dg’. Error is 16047
- How to Solve Error: Scanner class java. Util. NoSuchElementException exception