Mega Code Archive

 
Categories / Java / Development Class
 

Get the OS

/**  *     DEScribe - A Discrete Experience Sampling cross platform application     Copyright (C) 2011     Sébastien Faure <sebastien.faure3@gmail.com>,     Bertrand Gros   <gros.bertrand@gmail.com>,     Yannick Prie    <yannick.prie@univ-lyon1.fr>.     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  <sebastien.faure3@gmail.com>  * @author Bertrand Gros    <gros.bertrand@gmail.com>  * @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") >=0 || os.indexOf( "nux") >=0);   } }