Determining the Java version at runtime

Try this:

import java.util.*;
import java.text.*;
import java.io.*;
 
public class Main10
{
   public static void main(String [] args) throws Exception {
      String vendor = System.getProperty("java.vendor");
      String version = System.getProperty("java.version");
  
      System.out.println("vendor: " + vendor + "nversion: " + version);
   }
}

output like:

vendor: Sun Microsystems Inc.
version: 1.2.2