All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.ckjava.utils.OSUtils Maven / Gradle / Ivy

package com.ckjava.utils;

import java.util.Properties;

/**
 * 操作系统相关工具方法
 * 
 * @author ck
 *
 */
public class OSUtils implements Constants {
	
	private static Properties props = System.getProperties();

	/**
	 * 获取当前的操作系统类型
	 *
	 * @return windows or mac or linux
	 */
	public static String getCurrentOSType() {
		String osName = props.getProperty("os.name").toLowerCase();
		if (osName.contains(OSTYPE.WINDOWS)) {
			return OSTYPE.WINDOWS;
		} else if (osName.contains(OSTYPE.MAC)) {
			return OSTYPE.MAC;
		} else if (osName.contains(OSTYPE.LINUX)) {
			return OSTYPE.LINUX;
		} else {
			return null;
		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy