3253-omnibus save
[jalview.git] / src / jalview / util / Platform.java
index 99c82a4..d32735b 100644 (file)
@@ -133,6 +133,7 @@ public class Platform
    /**
    *
    * @return true if we are running in non-interactive no UI mode
+   * based on System.getProperty("java.awt.headless")
    */
    public static boolean isHeadless()
    {
@@ -847,4 +848,22 @@ public class Platform
     return f.toString();
   }
 
+  private static float javaVersion;
+  
+  public static float getJavaVersion()
+  {
+    if (javaVersion == 0)
+    {
+      try
+      {
+        return javaVersion = Float.parseFloat(
+                System.getProperty("java.specification.version"));
+      } catch (Exception e)
+      {
+        javaVersion = 1.8f;
+      }
+    }
+    return javaVersion;
+  }
+
 }