forked from j62/ctbrec
1
0
Fork 0

Add new class to determine the Java version

This commit is contained in:
0xboobface 2018-11-14 13:37:36 +01:00
parent 3bcbf100fe
commit 22dbb82c66
1 changed files with 28 additions and 0 deletions

View File

@ -0,0 +1,28 @@
package ctbrec;
public class Java {
public static int version() {
String specVersion = System.getProperty("java.specification.version");
switch(specVersion) {
case "1.7":
return 7;
case "1.8":
return 8;
case "9":
return 9;
case "10":
return 10;
case "11":
return 11;
case "12":
return 12;
default:
return 0;
}
}
public static void main(String[] args) {
System.out.println(Java.version());
}
}