获取JDK信息
System.out.println(System.getProperty("java.version"));
System.out.println(System.getProperty("java.vendor"));
System.out.println(System.getProperty("java.vendor.url"));
System.out.println(System.getProperty("java.home"));
System.out.println(System.getProperty("java.vm.specification.version"));
System.out.println(System.getProperty("java.vm.specification.vendor"));
System.out.println(System.getProperty("java.vm.specification.name"));
System.out.println(System.getProperty("java.vm.version"));
System.out.println(System.getProperty("java.vm.vendor"));
System.out.println(System.getProperty("java.vm.name"));
System.out.println(System.getProperty("java.specification.version"));
System.out.println(System.getProperty("java.specification.vendor"));
System.out.println(System.getProperty("java.specification.name"));
System.out.println(System.getProperty("java.class.version"));
System.out.println(System.getProperty("java.class.path"));
System.out.println(System.getProperty("java.library.path"));
System.out.println(System.getProperty("java.io.tmpdir"));
System.out.println(System.getProperty("java.compiler"));
System.out.println(System.getProperty("java.ext.dirs"));
获取系统信息
System.out.println(System.getProperty("os.name"));
System.out.println(System.getProperty("os.arch"));
System.out.println(System.getProperty("os.version"));
System.out.println(System.getProperty("file.separator"));
System.out.println(System.getProperty("path.separator"));
System.out.println(System.getProperty("line.separator"));
System.out.println(System.getProperty("user.name"));
System.out.println(System.getProperty("user.home"));
System.out.println(System.getProperty("user.dir"));
获取Tomacat信息
<%= application.getServerInfo() %>
Properties props = System.getProperties();
Runtime runtime = Runtime.getRuntime();
long freeMemoery = runtime.freeMemory();
long totalMemory = runtime.totalMemory();
long usedMemory = totalMemory - freeMemoery;
long maxMemory = runtime.maxMemory();
long useableMemory = maxMemory - totalMemory + freeMemoery;
model.addAttribute("member_count", member_count);
model.addAttribute("props", props);
model.addAttribute("freeMemoery", freeMemoery);
model.addAttribute("totalMemory", totalMemory);
model.addAttribute("usedMemory", usedMemory);
model.addAttribute("maxMemory", maxMemory);
model.addAttribute("useableMemory", useableMemory);
<td width="110">操作系统版本: </td>
<td>${props['os.name']!} ${props['os.version']!}</td>
</tr>
<tr>
<td>操作系统类型: </td>
<td>${props['os.arch']!} ${props['sun.arch.data.model']!}位</td>
</tr>
<tr>
<td>Java运行环境: </td>
<td>${props['java.runtime.name']!} ${props['java.runtime.version']!}</td>
</tr>
<tr>
<td>JAVA虚拟机: </td>
<td>${props['java.vm.name']!} ${props['java.vm.version']!}</td>
</tr>
<tr>
<td>系统帐号: </td>
<td>${props['user.name']!}</td>
</tr>
<tr>
<td>内存(MB): </td>
<td>已用:${(usedMemory/1024/1024)?string("0.##")} / 剩余:${(useableMemory/1024/1024)?string("0.##")} / 最大:${(maxMemory/1024/1024)?string("0.##")}</td>
</tr>
<tr>
<td style="border-bottom:none;">目录: </td>
<td style="border-bottom:none;"><textarea style="font-size:12px;width:220px;height:30px;" readonly>${props['user.dir']!},临时目录:${props['java.io.tmpdir']!}</textarea></td>
Key | Description of Associated Value | 中文描述 |
java.version | Java Runtime Environment version | Java 运行时环境版本 |
java.vendor | Java Runtime Environment vendor | Java 运行时环境供应商 |
java.vendor.url | Java vendor URL | Java 供应商的 URL |
java.home | Java installation directory | Java 安装目录 |
java.vm.specification.version | Java Virtual Machine specification version | Java 虚拟机规范版本 |
java.vm.specification.vendor | Java Virtual Machine specification vendor | Java 虚拟机规范供应商 |
java.vm.specification.name | Java Virtual Machine specification name | Java 虚拟机规范名称 |
java.vm.version | Java Virtual Machine implementation version | Java 虚拟机实现版本 |
java.vm.vendor | Java Virtual Machine implementation vendor | Java 虚拟机实现供应商 |
java.vm.name | Java Virtual Machine implementation name | Java 虚拟机实现名称 |
java.specification.version | Java Runtime Environment specification version | Java 运行时环境规范版本 |
java.specification.vendor | Java Runtime Environment specification vendor | Java 运行时环境规范供应商 |
java.specification.name | Java Runtime Environment specification name | Java 运行时环境规范名称 |
java.class.version | Java class format version number | Java 类格式版本号 |
java.class.path | Java class path | Java 类路径 |
java.library.path | List of paths to search when loading libraries | 加载库时搜索的路径列表 |
java.io.tmpdir | Default temp file path | 默认的临时文件路径 |
java.compiler | Name of JIT compiler to use | 要使用的 JIT 编译器的名称 |
java.ext.dirs | Path of extension directory or directories | 一个或多个扩展目录的路径 |
os.name | Operating system name | 操作系统的名称 |
os.arch | Operating system architecture | 操作系统的架构 |
os.version | Operating system version | 操作系统的版本 |
file.separator | File separator ("/" on UNIX) | 文件分隔符(在 UNIX 系统中是“/”) |
path.separator | Path separator (":" on UNIX) | 路径分隔符(在 UNIX 系统中是“:”) |
line.separator | Line separator ("\n" on UNIX) | 行分隔符(在 UNIX 系统中是“/n”) |
user.name | User's account name | 用户的账户名称 |
user.home | User's home directory | 用户的主目录 |
user.dir | User's current working directory | 用户的当前工作目录 |