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 ()
 http://developer.apple.com/technotes/tn2002/tn2110.html
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.

Author:
Ron B Yeh (ronyeh(AT)cs.stanford.edu)

Definition at line 18 of file SystemUtils.java.


Member Function Documentation

static void addToLibraryPath ( URL  url  )  [static]

This doesn't work.

=\

TODO: See: http://www.velocityreviews.com/forums/t143553-dll-in-jar.html for a possible solution to load dlls from the jar file. Alternate idea: http://forum.java.sun.com/thread.jspa?threadID=563861&messageID=3123713

Parameters:
url 

Definition at line 50 of file SystemUtils.java.

References SystemUtils.LIBRARY_PATH_KEY, and SystemUtils.PATH_SEPARATOR.

static double getFreeMemoryInMB (  )  [static]

Returns:
the number of megabytes of free memory

Definition at line 64 of file SystemUtils.java.

static File getWorkingDirectory (  )  [static]

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

Definition at line 71 of file SystemUtils.java.

static boolean operatingSystemIsMacOSX (  )  [static]

http://developer.apple.com/technotes/tn2002/tn2110.html

Returns:
true if the jvm is running on mac os x

Definition at line 80 of file SystemUtils.java.

static boolean operatingSystemIsWindowsVariant (  )  [static]

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

Definition at line 88 of file SystemUtils.java.

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: http://bugs.sun.com/bugdatabase/view_bug.do;: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.

Parameters:
file 
Deprecated:

Definition at line 113 of file SystemUtils.java.


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 SystemUtils.java.

Referenced by SystemUtils.addToLibraryPath().

final String LINE_SEPARATOR [static]

Initial value:

 System.getProperties()
                        .getProperty("line.separator")
System character(s) for separating lines.

Different for Unix/DOS/Mac.

Definition at line 31 of file SystemUtils.java.


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