Skip to Content

Get Java specification version using System class

  1. /*
  2.         Get Java specification version using System class
  3.         This example shows how to get the Java specification version
  4.         using System class.
  5. */
  6.  
  7. public class GetJavaVersion {
  8.  
  9.         public static void main(String[] args) {
  10.                
  11.                 /*
  12.                  * Get java.specification.version system property using
  13.                  * public static String getProperty(String name) method of
  14.                  * System class.
  15.                  */
  16.                
  17.                 String strJavaVersion = System.getProperty("java.specification.version");
  18.                
  19.                 System.out.println("Java Specification is : " + strJavaVersion);
  20.         }
  21. }
  22.  
  23. /*
  24. Output would be system dependent. Typical output would be
  25. Java Specification is : 1.3
  26. */