artisynth.core.util
Class JVMInfo

java.lang.Object
  extended by artisynth.core.util.JVMInfo

public class JVMInfo
extends java.lang.Object


Constructor Summary
JVMInfo()
           
 
Method Summary
static void addJavaLibraryPath(java.lang.String newPath)
          Adds location to current java.library.path.
static void appendDefaultLibraryPath()
          Add Default to library-path
static java.lang.String getCPUSpeed()
           
static java.lang.String getOSType()
          Returns machine type of the System: Windows, Linux, Darwin.
static boolean isJava14()
          Returns true if ImageJ is running on a Java 1.4 or greater JVM.
static boolean isJava15()
          Returns true if ImageJ is running on a Java 1.5 or greater JVM.
static boolean isJava2()
          Returns true if ImageJ is running on Java 2.
static boolean isLinux()
          Returns true if ImageJ is running on Linux.
static boolean isMacintosh()
          Returns true if this machine is a Macintosh.
static boolean isMacOSX()
          Returns true if this machine is a Macintosh running OS X.
static boolean isWindows()
          Returns true if this machine is running Windows.
static void main(java.lang.String[] args)
          Prints system info
static void printglinfo()
          Prints opengl info and exists
static void printUsrPathField()
          Prints content of ClassLoader.usr_path field.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JVMInfo

public JVMInfo()
Method Detail

appendDefaultLibraryPath

public static void appendDefaultLibraryPath()
                                     throws java.lang.SecurityException,
                                            java.lang.NoSuchFieldException,
                                            java.lang.IllegalArgumentException,
                                            java.lang.IllegalAccessException
Add Default to library-path

Throws:
java.lang.NoSuchFieldException
java.lang.SecurityException
java.lang.IllegalAccessException
java.lang.IllegalArgumentException

addJavaLibraryPath

public static void addJavaLibraryPath(java.lang.String newPath)
Adds location to current java.library.path. Original idea from http://forum.java.sun.com/thread.jspa?threadID=627890 Approach uses Java reflection and knowledge of internal classloader mechanism and thus it is a bit dirty solution. Future versions can change behaviour and this may not work. However it's probably the only way how to do it now. Here is way it is working: ClassLoader.loadLibrary(Class fromClass, String name, boolean isAbsolute) { ... if (sys_paths == null) { usr_paths = initializePath("java.library.path"); sys_paths = initializePath("sun.boot.library.path"); } ... }

Parameters:
newPath -

printUsrPathField

public static void printUsrPathField()
Prints content of ClassLoader.usr_path field. usr_path field is created from java.library.path property, when ClassLoader.sys_path == null. usr_path field contains array of paths, where ClassLoader is searching for native libraries.


getOSType

public static java.lang.String getOSType()
Returns machine type of the System: Windows, Linux, Darwin.


isMacintosh

public static boolean isMacintosh()
Returns true if this machine is a Macintosh.


isMacOSX

public static boolean isMacOSX()
Returns true if this machine is a Macintosh running OS X.


isWindows

public static boolean isWindows()
Returns true if this machine is running Windows.


isJava2

public static boolean isJava2()
Returns true if ImageJ is running on Java 2.


isJava14

public static boolean isJava14()
Returns true if ImageJ is running on a Java 1.4 or greater JVM.


isJava15

public static boolean isJava15()
Returns true if ImageJ is running on a Java 1.5 or greater JVM.


isLinux

public static boolean isLinux()
Returns true if ImageJ is running on Linux.


main

public static void main(java.lang.String[] args)
Prints system info


getCPUSpeed

public static java.lang.String getCPUSpeed()

printglinfo

public static void printglinfo()
Prints opengl info and exists