Get the OS : OS « Development Class « Java

Home
Java
1.2D Graphics GUI
2.3D
3.Advanced Graphics
4.Ant
5.Apache Common
6.Chart
7.Class
8.Collections Data Structure
9.Data Type
10.Database SQL JDBC
11.Design Pattern
12.Development Class
13.EJB3
14.Email
15.Event
16.File Input Output
17.Game
18.Generics
19.GWT
20.Hibernate
21.I18N
22.J2EE
23.J2ME
24.JavaFX
25.JDK 6
26.JDK 7
27.JNDI LDAP
28.JPA
29.JSP
30.JSTL
31.Language Basics
32.Network Protocol
33.PDF RTF
34.Reflection
35.Regular Expressions
36.Scripting
37.Security
38.Servlets
39.Spring
40.Swing Components
41.Swing JFC
42.SWT JFace Eclipse
43.Threads
44.Tiny Application
45.Velocity
46.Web Services SOA
47.XML
Java » Development Class » OS 




Get the OS
     
/**
 *
    DEScribe - A Discrete Experience Sampling cross platform application
    Copyright (C) 2011
    Sébastien Faure <[email protected]>,
    Bertrand Gros   <[email protected]>,
    Yannick Prie    <[email protected]>.

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

//package api.utils;

/**
 * Class getOs.java
 * @description Tools around OS detection
 @author Sébastien Faure  <[email protected]>
 @author Bertrand Gros    <[email protected]>
 @version 2011-01-28
 */
public class getOs {

  public static boolean isWindows(){

    String os = System.getProperty("os.name").toLowerCase();
    //windows
      return (os.indexOf"win" >= 0);

  }

  public static boolean isMac(){

    String os = System.getProperty("os.name").toLowerCase();
    //Mac
      return (os.indexOf"mac" >= 0);

  }

  public static boolean isUnix(){

    String os = System.getProperty("os.name").toLowerCase();
    //linux or unix
      return (os.indexOf"nix">=|| os.indexOf"nux">=0);

  }
}

   
    
    
    
    
  














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.Virtual Machine Information (JVM)
9.Java Platform Information
10.Get OS Info
11.Platform Detector
12.OS detector
13.OS name
14.Operating System
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.