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. |
This software is distributed under the BSD License.
Definition at line 18 of file SystemUtils.java.
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
url |
Definition at line 50 of file SystemUtils.java.
References SystemUtils.LIBRARY_PATH_KEY, and SystemUtils.PATH_SEPARATOR.
static double getFreeMemoryInMB | ( | ) | [static] |
static File getWorkingDirectory | ( | ) | [static] |
Definition at line 71 of file SystemUtils.java.
static boolean operatingSystemIsMacOSX | ( | ) | [static] |
http://developer.apple.com/technotes/tn2002/tn2110.html
Definition at line 80 of file SystemUtils.java.
static boolean operatingSystemIsWindowsVariant | ( | ) | [static] |
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.
file |
Definition at line 113 of file SystemUtils.java.
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")
Different for Unix/DOS/Mac.
Definition at line 31 of file SystemUtils.java.