How To Find What Java Version You Are Using?

One of the visitors of my blog asked me a question, “hey Kushal what java version are you using to compile your files” ? Well, I had lots of java versions installed in my computer for many different reasons. Honestly I wasn’t sure which version was I exactly using. So I wrote this little utiltiy that tells you the java version that you are currently using and the vendor of that java. Remember Sun Microsystems is not the sole java vendor. There are many others.

package com.kushal.utils;
/**
 * @author Kushal Paudyal
 * www.sanjaal.com/java
 * Last Modified On 05-20-2009
 */

/**
 * Demonstrates a simple way of getting
 * --Java Version
 * --Java Vendor
 */
public class GetJavaVersionAndVendor {

	public static void main(String args [])
	{
		String version=System.getProperty("java.version");
		String vendor=System.getProperty("java.vendor");

		System.out.println("Java Version Is: "+version);
		System.out.println("Java Vendor Is: "+vendor);
	}

}

———————-
Here is the sample output of this program

Java Version Is: 1.6.0_11
Java Vendor Is: Sun Microsystems Inc.