1
22
23 package com.liferay.portal.kernel.util;
24
25 import com.liferay.portal.kernel.log.Log;
26 import com.liferay.portal.kernel.log.LogFactoryUtil;
27 import com.liferay.portal.kernel.log.LogUtil;
28
29
35 public class JavaProps {
36
37 public static final double JAVA_CLASS_VERSION_JDK_5 = 49.0;
38
39 public static String getJavaClassPath() {
40 return _instance._javaClassPath;
41 }
42
43 public static double getJavaClassVersion() {
44 return _instance._javaClassVersion;
45 }
46
47 public static String getJavaRuntimeVersion() {
48 return _instance._javaRuntimeVersion;
49 }
50
51 public static double getJavaSpecificationVersion() {
52 return _instance._javaSpecificationVersion;
53 }
54
55 public static String getJavaVersion() {
56 return _instance._javaVersion;
57 }
58
59 public static String getJavaVmVersion() {
60 return _instance._javaVmVersion;
61 }
62
63 public static boolean isJDK5() {
64 if (JavaProps.getJavaClassVersion() >=
65 JavaProps.JAVA_CLASS_VERSION_JDK_5) {
66
67 return true;
68 }
69 else {
70 return false;
71 }
72 }
73
74 private JavaProps() {
75 _javaClassPath = System.getProperty("java.class.path");
76 _javaClassVersion = Double.parseDouble(System.getProperty(
77 "java.class.version"));
78 _javaRuntimeVersion = System.getProperty("java.runtime.version");
79 _javaSpecificationVersion = Double.parseDouble(System.getProperty(
80 "java.specification.version"));
81 _javaVersion = System.getProperty("java.version");
82 _javaVmVersion = System.getProperty("java.vm.version");
83
84 LogUtil.debug(_log, System.getProperties());
85 }
86
87 private static Log _log = LogFactoryUtil.getLog(JavaProps.class);
88
89 private static JavaProps _instance = new JavaProps();
90
91 private String _javaClassPath;
92 private double _javaClassVersion;
93 private String _javaRuntimeVersion;
94 private double _javaSpecificationVersion;
95 private String _javaVersion;
96 private String _javaVmVersion;
97
98 }