commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephen Colebourne" <scolebou...@btopenworld.com>
Subject [lang] System properties
Date Thu, 22 Aug 2002 19:58:53 GMT
One part I find inconvenient about Java is the system properties. These are
looked up by a string name, and I can never remember what the name is, so I
have to go and look it up the javadoc - a great waste of time.

The following code, is the solution in my library. Although seemingly
trivial, it means that any IDE can use code completion to pick the value
without needing to remember the string name.

    public static final String LINE_SEPARATOR =
System.getProperty("line.separator");
    public static final String PATH_SEPARATOR =
System.getProperty("path.separator");
    public static final String FILE_SEPARATOR =
System.getProperty("file.separator");
    public static final String WORKING_DIRECTORY =
System.getProperty("user.dir");
    public static final String OS_NAME = System.getProperty("os.name");
    public static final String OS_ARCH = System.getProperty("os.arch");
    public static final String OS_VERSION =
System.getProperty("os.version");
    public static final String JAVA_VERSION =
System.getProperty("java.version");

How about a SystemUtils for [lang] ?

Stephen


--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message