For certain versions of Java, you can check the bitness of the JVM from the command line with the flags -d32
and -d64
.
$ java -help
...
-d32 use a 32-bit data model if available
-d64 use a 64-bit data model if available
To check for a 64-bit JVM, run:
$ java -d64 -version
If it’s not a 64-bit JVM, you’ll get this:
Error: This Java instance does not support a 64-bit JVM.
Please install the desired version.
Similarly, to check for a 32-bit JVM, run:
$ java -d32 -version
If it’s not a 32-bit JVM, you’ll get this:
Error: This Java instance does not support a 32-bit JVM.
Please install the desired version.
These flags were added in Java 7, deprecated in Java 9, removed in Java 10, and no longer available on modern versions of Java.