Skip to main content

Blarg #19: Simple things make me happy. An list.

Posted by jfalkner on February 27, 2006 at 12:44 PM PST

I like that Java can tell you what platform it is running on, but often I forget what strings to expect from the and os.arch System properties. Google revealed a nice list.

Why would you ever want to use this? It is handy in any case where you need to know if you are running on Mac OSX, Linux, Windows, or any other specific platform. For instance, if you want to save a config file in an appropriate directory, e.g. "C:\Program Files\MyApp" versus "/opt/MyApp"

Since I referenced the list, may as well reference how you would get the property.

String os = System.getProperty("");

Hooray for the simple things. Thanks to the Lopica project for keeping this list.

Related Topics >>