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.JDK 6
25.JNDI LDAP
26.JPA
27.JSP
28.JSTL
29.Language Basics
30.Network Protocol
31.PDF RTF
32.Reflection
33.Regular Expressions
34.Scripting
35.Security
36.Servlets
37.Spring
38.Swing Components
39.Swing JFC
40.SWT JFace Eclipse
41.Threads
42.Tiny Application
43.Velocity
44.Web Services SOA
45.XML
Java » Development Class » OSScreenshots 
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.