Java判断操作系统是Windows或Mac,获取用户路径

阿里云国内75折 回扣 微信号:monov8
阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6

package other;

public class CheckSystem {

public static void main(String[] args) {

String osName = System.getProperty("os.name");

System.out.println(osName); //Windows 10

if (osName.startsWith("Windows")) {

System.out.println("Windows");

} else {

System.out.println("Mac");

}

String userName = System.getProperty("user.home"); //获取用户的路径 C:\Users\jeff.xie

System.out.println(userName);

String path ="D:\\Project\\Program\\screenshots";

String flag ="android";

CompressPicture compressPicture = new CompressPicture();

//String flag =System.getProperty("mobile").toUpperCase();

double compressPercent=0.2;

if(flag.contains("IOS")) compressPercent =0.4;

String compressScreenShotsPath =compressPicture.changeByDir( path,0,0,compressPercent);

GetScreenShot getScreenShot = new GetScreenShot();

getScreenShot.create_result_report(compressScreenShotsPath, flag);

}

}

阿里云国内75折 回扣 微信号:monov8
阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6
标签: windowsJava