获取jdk、用户名等基本信息操作方法

时间:2020-04-29 14:21:53   收藏:0   阅读:51
/**
* @auto dh
* @create 2020-04-29-13:37
*/
public class Test014 {
public static void main(String[] args) {
// 获得jdk版本信息
String javaVersion=System.getProperty("java.version");
System.out.println(javaVersion);
// 获取jdk所在路径
String javaHome=System.getProperty("java.home");
System.out.println(javaHome);
// 获取操作系统名
String os=System.getProperty("os.name");
System.out.println(os);
// 获取操作系统版本号
String osVersion=System.getProperty("os.version");
System.out.println(osVersion);
// 获取用户名
String user=System.getProperty("user.name");
System.out.println(user);
// 获取用户名文件所在路径
String userHome=System.getProperty("user.home");
System.out.println(userHome);
// 获取当项目所在的文件路径
String userDir=System.getProperty("user.dir");
System.out.println(userDir);
}
}

原文:https://www.cnblogs.com/kukai/p/12801727.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!