The Source for Java Technology Collaboration
User: Password:



Jayson Falkner

Jayson Falkner's Blog

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

Posted by jfalkner on February 27, 2006 at 12:44 PM | Comments (0)

I like that Java can tell you what platform it is running on, but often I forget what strings to expect from the os.name 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("os.name");

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


Bookmark blog post: del.icio.us del.icio.us Digg Digg DZone DZone Furl Furl Reddit Reddit
Comments
Comments are listed in date ascending order (oldest first) | Post Comment



Only logged in users may post comments. Login Here.


Powered by
Movable Type 3.01D
 Feed java.net RSS Feeds