Platform Detector : OS « Development Class « Java

Platform Detector

 * Created on May 12, 2007, 11:41 AM
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.

//package mvplan.util;

 * @author guy
public class PlatformDetector {
  public static final int MACOS = 0;
  public static final int UNIX = 1;
  public static final int WINDOWS = 3;

  /** Creates a new instance of PlatformDetector */
  public static int detect() {
    String osName = System.getProperty("");
    if (osName.startsWith("Mac OS"))
      return MACOS;
    else if (osName.startsWith("Windows"))
      return WINDOWS;
      // assume Unix or Linux
      return UNIX;


Related examples in the same category

1.Class representing a standard operating system platform, WIN, MAC, or POSIX.
2.Get OS
3.Platform specific functionality.
4.Condition that tests the OS type.
5.Class to help determining the OS
6.Splits apart a OS separator delimited set of paths in a string into multiple Strings.
7.Get the operating systemGet the operating system
8.Get the OS
9.Virtual Machine Information (JVM)
10.Java Platform Information
11.Get OS Info
12.OS detector
13.OS name
14.Operating System