Find out Java version (32 or 64 bit JVM) installed in your system using java program and cmd

You are here : Home / Core Java Tutorials /

In this tutorial we will find out Java version installed in your system


How to find out Java version installed in your system/windows >
  1. You may use this java program to find Java version installed in your system/windows >



if 32 bit java version is installed than (System.getProperty("sun.arch.data.model")) returns 32

if 64 bit java version is installed than (System.getProperty("sun.arch.data.model")) returns 64

/** Find current JVM version (32 bit java version or 64 bit java version ?) */
public class FindCurrentJavaVersionExample {
   public static void main(String[] args) {
          String currentJavaVersion = System.getProperty("sun.arch.data.model");
          System.out.println("current Java Version on system = "+
                       currentJavaVersion);
   }
}
/*OUTPUT
current Java Version on system = 64
*/

output of program may vary on different systems, mines system have 64 bit java version installed

  1. You may use this CMD command to find Java version installed in your system/windows >
Java -version
But before using this command you must set JAVA_HOME and PATH.

  1. You may use this following CMD commands as well to find Java version installed in your system/windows > >
Java -d32
If system has 64 JVM installed then error message will be > This Java instance does not support a 32-bit JVM
Java -d64
If system has 32 JVM installed then error message will be > This Java instance does not support a 64-bit JVM



Summary -

So in this tutorial we found out Java version installed in your system



Having any doubt? or you you liked the tutorial! Please comment in below section.
Please express your love by liking JavaMadeSoEasy.com (JMSE) on facebook, following on google+ or Twitter.



RELATED LINKS>

Find out Java version (32 or 64 bit) installed in your system using java program and cmd


Find out JDK version installed in your system using java program


Find eclipse version in your system


Labels: Core Java
eEdit
Must read for you :