SystemUtils Class Reference

List of all members.

Static Public Member Functions

static void addToLibraryPath (URL url)
 This doesn't work.
static double getFreeMemoryInMB ()
static File getWorkingDirectory ()
static boolean operatingSystemIsMacOSX ()
static boolean operatingSystemIsWindowsVariant ()
static void setWorkingDirectory (File file)
 Sets the user.dir property, so that you can make code dealing with files easier to type/read.
static void tic ()
 Save the current time, for simple profiling.
static void toc ()
 Prints out the difference between now and the last time we tic'ed.

Static Public Attributes

static final String LIBRARY_PATH_KEY = "java.library.path"
 Where to look for DLLs.
static final String LINE_SEPARATOR
 System character(s) for separating lines.
static final String PATH_SEPARATOR = System.getProperty("path.separator")
 Different for UNIX/WINDOWS/MAC.

Detailed Description

Environment Variables, OS specific tasks, etc.

This software is distributed under the BSD License.

Ron B Yeh (ronyeh(AT)

Definition at line 18 of file

Member Function Documentation

static void addToLibraryPath ( URL  url  )  [static]

This doesn't work.


TODO: See: for a possible solution to load dlls from the jar file. Alternate idea:


Definition at line 50 of file

References SystemUtils.LIBRARY_PATH_KEY, and SystemUtils.PATH_SEPARATOR.

static double getFreeMemoryInMB (  )  [static]

the number of megabytes of free memory

Definition at line 64 of file

static File getWorkingDirectory (  )  [static]

where new File(".").getAbsolutePath() points...

Definition at line 71 of file

static boolean operatingSystemIsMacOSX (  )  [static]

true if the jvm is running on mac os x

Definition at line 80 of file

static boolean operatingSystemIsWindowsVariant (  )  [static]

if the jvm is running on windows 9x/NT/2000/XP/Vista

Definition at line 88 of file

static void setWorkingDirectory ( File  file  )  [static]

Sets the user.dir property, so that you can make code dealing with files easier to type/read.

WARNING: Java seems to have a usability bug in this manner.... Do not use this method for now.

SystemUtils.setWorkingDirectory(new File("data/Flickr/")); // argh! Setting the Working Directory doesn't work for files in this manner. // Quite Stupid, in fact. System.out.println(new File("Twistr1.xml").exists()); // returns false System.out.println(new File("Twistr1.xml").getAbsoluteFile().exists()); // returns true

This is a KNOWN Java bug:;:YfiG?bug_id=4117557 Phooey. That means you have to call getAbsoluteFile() at every point in which you read a file stream. I will have to instrument SystemUtils & FileUtils to handle this.


Definition at line 113 of file

Member Data Documentation

final String LIBRARY_PATH_KEY = "java.library.path" [static]

Where to look for DLLs.

Unfortunately, you cannot change this at runtime and expect the classloaders to find the dlls correctly.

Definition at line 26 of file

Referenced by SystemUtils.addToLibraryPath().

final String LINE_SEPARATOR [static]

Initial value:

System character(s) for separating lines.

Different for Unix/DOS/Mac.

Definition at line 31 of file

The documentation for this class was generated from the following file:
Generated on Sat Apr 14 18:21:45 2007 for R3 Paper Toolkit by  doxygen 1.4.7