Package com.bric.util

Class JVM


  • public class JVM
    extends java.lang.Object
    Static methods relating to the JVM environment.

    Instead of burying a constant like "isQuartz" in its most relevant class (such as OptimizedGraphics2D), it should be stored here so if other classes need to access it they don't necessary have to

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static boolean isMac
      Whether this session is on a Mac.
      static boolean isVista
      Whether this session is on Vista.
      static boolean isWindows
      Whether this session is on Windows.
      static float javaVersion
      The major Java version being used (1.4, 1.5, 1.6, etc.), or -1 if this value couldn't be correctly determined.
      static boolean usingQuartz
      If on a Mac: whether Quartz is the rendering pipeline.
    • Constructor Summary

      Constructors 
      Constructor Description
      JVM()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static float getMajorJavaVersion()
      This converts the system property "java.version" to a float value.
      static float getMajorJavaVersion​(boolean catchSecurityException)  
      static java.lang.String getProfile()
      Gets basic information about this session's JVM: the OS name & version, the Java version, and (on Mac) whether Quartz is being used.
      static void printProfile()
      Prints basic information about this session's JVM: the OS name & version, the Java version, and (on Mac) whether Quartz is being used.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • javaVersion

        public static final float javaVersion
        The major Java version being used (1.4, 1.5, 1.6, etc.), or -1 if this value couldn't be correctly determined.
      • isMac

        public static final boolean isMac
        Whether this session is on a Mac.
      • isWindows

        public static final boolean isWindows
        Whether this session is on Windows.
      • isVista

        public static final boolean isVista
        Whether this session is on Vista.
      • usingQuartz

        public static final boolean usingQuartz
        If on a Mac: whether Quartz is the rendering pipeline.
    • Constructor Detail

      • JVM

        public JVM()
    • Method Detail

      • printProfile

        public static void printProfile()
        Prints basic information about this session's JVM: the OS name & version, the Java version, and (on Mac) whether Quartz is being used.
      • getProfile

        public static java.lang.String getProfile()
        Gets basic information about this session's JVM: the OS name & version, the Java version, and (on Mac) whether Quartz is being used.
      • getMajorJavaVersion

        public static float getMajorJavaVersion()
                                         throws java.security.AccessControlException
        This converts the system property "java.version" to a float value. This drops rightmost digits until a legitimate float can be parsed.
        For example, this converts "1.6.0_05" to "1.6".
        This value is cached as the system property "java.major.version". Although technically this value is a String, it will always be parseable as a float.
        Throws:
        java.security.AccessControlException - this may be thrown in unsigned applets! Beware!
      • getMajorJavaVersion

        public static float getMajorJavaVersion​(boolean catchSecurityException)
        Parameters:
        catchSecurityException - if true and an exception occurs, then -1 is returned.
        Returns:
        the major java version, or -1 if this can't be determined/