utils
Class SystemUtils

java.lang.Object
  extended by utils.SystemUtils

public class SystemUtils
extends java.lang.Object

DocJava, Inc. http://www.docjava.com Programmer: dlyon Date: Mar 29, 2004 Time: 3:33:32 PM


Constructor Summary
SystemUtils()
           
 
Method Summary
static void appendJavaExtensionsDirectory(java.lang.String p)
           
static java.lang.String free()
           
static java.lang.String getBootPath()
           
static java.lang.String getClassPath()
           
static java.lang.String getDefaultEncoding()
          Return the system default text encoding.
static java.lang.String getDirectorySeparator()
           
static java.io.File getJavaCommand()
           
static java.lang.String getJavaExtensionsDirectory()
           
static java.lang.String getJavaVersion()
           
static long getLastModified(java.net.URL resourceUrl)
           
static java.lang.String getLocationOfCurrentlyRunningProgram()
           
static java.lang.Object[] getNullArray()
           
static java.lang.String getPathSeparator()
           
static java.lang.String getProps()
           
static java.io.File getSdkCommand(java.lang.String command)
           
static java.lang.String getSysInfo()
           
static java.io.File getTempDirectory()
           
static java.io.File getTmpDir()
           
static java.lang.String getUid()
           
static java.util.Date getUrlModificationDate(java.net.URL url)
           
static java.lang.String getUserHome()
          Returns the users home directory.
static java.lang.String getUserName()
           
static java.io.File getUserPrefLocation()
           
static boolean isDateGood(java.io.File canonicalFile, java.net.URL resourceUrl)
           
static boolean isJava2()
           
static boolean isMacJDK1_3()
           
static void main(java.lang.String[] args)
           
static void makeDir(java.io.File file)
           
static java.io.File makeTmpDir(java.lang.String tmpDir)
           
static void printJavaHome()
           
static void printMethodNames(PrintStub printStub, java.lang.reflect.Method[] ma)
           
static void printMethods(PrintStub printStub, java.lang.reflect.Method[] methods)
           
static void printProp(java.lang.String p)
           
static void printProps()
           
static void printProps(PrintStub printStubFrame1)
           
static void printUserDir()
           
static void props()
           
static void runGc()
           
static java.lang.String[] runMain(java.lang.Class classToRun)
          This method runs the main in a class, c, in a different JVM.
static void testClassPathBug()
           
static void testPrintProps()
           
static void testRunMain()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SystemUtils

public SystemUtils()
Method Detail

getUrlModificationDate

public static java.util.Date getUrlModificationDate(java.net.URL url)
                                             throws java.io.IOException
Throws:
java.io.IOException

getUid

public static java.lang.String getUid()

getJavaExtensionsDirectory

public static java.lang.String getJavaExtensionsDirectory()

getBootPath

public static java.lang.String getBootPath()

appendJavaExtensionsDirectory

public static void appendJavaExtensionsDirectory(java.lang.String p)

getTempDirectory

public static java.io.File getTempDirectory()
                                     throws java.io.IOException
Returns:
a temp directory that can be deleted upon exit
Throws:
java.io.IOException

getLocationOfCurrentlyRunningProgram

public static java.lang.String getLocationOfCurrentlyRunningProgram()
Returns:
the location of the program that is running. Typically something like:
/User/lyon/current/j4p.

getDirectorySeparator

public static java.lang.String getDirectorySeparator()
Returns:
the character(s) used to delimit directories in path names. For example:
/home/lyon/jaxbtest, the file separator is "/".

getPathSeparator

public static java.lang.String getPathSeparator()
Returns:
return the character use to delimit the paths in a list of paths.

printProps

public static void printProps()

getProps

public static java.lang.String getProps()

testPrintProps

public static void testPrintProps()

free

public static java.lang.String free()
Returns:
a string that describes the JVM's free RAM

runGc

public static void runGc()

props

public static void props()

printProp

public static void printProp(java.lang.String p)

getClassPath

public static java.lang.String getClassPath()

printJavaHome

public static void printJavaHome()

printUserDir

public static void printUserDir()

getUserHome

public static java.lang.String getUserHome()
Returns the users home directory. For example: C:\Documents and Settings\dlyon


getUserPrefLocation

public static java.io.File getUserPrefLocation()

getSysInfo

public static java.lang.String getSysInfo()

testRunMain

public static void testRunMain()
                        throws java.io.IOException
Throws:
java.io.IOException

isJava2

public static boolean isJava2()
Returns:
true if the present version of Java is java2.

getNullArray

public static java.lang.Object[] getNullArray()

testClassPathBug

public static void testClassPathBug()

printProps

public static void printProps(PrintStub printStubFrame1)

printMethods

public static void printMethods(PrintStub printStub,
                                java.lang.reflect.Method[] methods)

printMethodNames

public static void printMethodNames(PrintStub printStub,
                                    java.lang.reflect.Method[] ma)

getSdkCommand

public static java.io.File getSdkCommand(java.lang.String command)

getJavaCommand

public static java.io.File getJavaCommand()
Returns:
the location of the java command.

runMain

public static java.lang.String[] runMain(java.lang.Class classToRun)
                                  throws java.io.IOException
This method runs the main in a class, c, in a different JVM. It uses the classpath of the current run-time environments

Throws:
java.io.IOException

getTmpDir

public static java.io.File getTmpDir()

isDateGood

public static boolean isDateGood(java.io.File canonicalFile,
                                 java.net.URL resourceUrl)
                          throws java.io.IOException
Throws:
java.io.IOException

getLastModified

public static long getLastModified(java.net.URL resourceUrl)
                            throws java.io.IOException
Throws:
java.io.IOException

main

public static void main(java.lang.String[] args)
                 throws java.io.IOException
Throws:
java.io.IOException

makeTmpDir

public static java.io.File makeTmpDir(java.lang.String tmpDir)

makeDir

public static void makeDir(java.io.File file)

getDefaultEncoding

public static java.lang.String getDefaultEncoding()
Return the system default text encoding. The jdk 1.5 has a method for this, not jdk 1.4. Hence this method.

Returns:
the system default text encoding.

getUserName

public static java.lang.String getUserName()

getJavaVersion

public static java.lang.String getJavaVersion()

isMacJDK1_3

public static boolean isMacJDK1_3()