java获取本地系统变量 Properties 及 RunTime

  1. Properties props = System.getProperties();  
  2.         Runtime runtime = Runtime.getRuntime();  
  3.         long freeMemoery = runtime.freeMemory();  
  4.         long totalMemory = runtime.totalMemory();  
  5.         long usedMemory = totalMemory - freeMemoery;  
  6.         long maxMemory = runtime.maxMemory();  
  7.         long useableMemory = maxMemory - totalMemory + freeMemoery;  
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;


  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
  2. <html xmlns="http://www.w3.org/1999/xhtml">  
  3. <head>  
  4. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>  
  5. <title>jeecms-left</title>  
  6. <#include "/jeecms_sys/head.html"/>  
  7. </head>  
  8. <body>  
  9.         <div class="box-positon">  
  10.              <h1><@s.m "global.position"/><@s.m "global.admin.home"/> - <@s.m "global.admin.index"/></h1>  
  11.         </div>  
  12. <div class="body-box">  
  13.         <div class="welcom-con">  
  14.              <div class="we-txt">  
  15.                   <p>  
  16.                   欢迎使用JEECMS内容管理系统!<br />  
  17.                   JEECMS程序版本: jeecmsv5.0 【<a href="http://www.jeecms.com" target="_blank">查看最新版本</a><br />  
  18.                   您上次登录的时间是:${user.lastLoginTime?string('yyyy-MM-dd')}<br />  
  19.                   已用内存:<span style="color:#0078ff;">${(usedMemory/1024/1024)?string("0.##")}MB</span>    剩余内存:<span style="color:#ff8400;">${(useableMemory/1024/1024)?string("0.##")}MB </span>    最大内存:<span style="color:#00ac41;">${(maxMemory/1024/1024)?string("0.##")}MB</span>  
  20.                   </p>  
  21.              </div>  
  22.              <ul class="ms">  
  23.                 <li class="wxx">访问量</li><li class="attribute">   系统属性</li>  
  24.              </ul>  
  25.              <div class="ms-xx">  
  26.                  <div class="xx-xx">  
  27.                       <table width="100%" border="0" cellspacing="0" cellpadding="0">  
  28.                        <tr>  
  29.                         <td width="20%" height="30" align="right"></td>  
  30.                         <td width="25%"><b>PV</b></td>  
  31.                         <td width="25%"><b>IP</b></td>  
  32.                         <td width="30%"><b>独立访客</b></td>  
  33.                     </tr>  
  34.                       <tr>  
  35.                         <td height="30" align="right">今日:</td>  
  36.                         <#list flowMap['today'] as f>  
  37.                         <td>${f.count}</td>  
  38.                         </#list>  
  39.                     </tr>  
  40.                       <tr>  
  41.                         <td height="30" align="right">昨日:</td>  
  42.                         <#list flowMap['yesterday'] as f>  
  43.                         <td>${f.count}</td>  
  44.                         </#list>  
  45.                     </tr>  
  46.                       <tr>  
  47.                         <td height="30" align="right">本周:</td>  
  48.                         <#list flowMap['thisweek'] as f>  
  49.                         <td>${f.count}</td>  
  50.                         </#list>  
  51.                     </tr>  
  52.                       <tr>  
  53.                         <td height="30" align="right">本月:</td>  
  54.                         <#list flowMap['thismonth'] as f>  
  55.                         <td>${f.count}</td>  
  56.                         </#list>  
  57.                      </tr>  
  58.                      <tr>  
  59.                         <td height="30" align="right">累计:</td>  
  60.                         <#list flowMap['total'] as f>  
  61.                         <td>${f.count}</td>  
  62.                         </#list>  
  63.                      </tr>  
  64.                </table>  
  65.                  </div>  
  66.                  <div class="attribute-xx" style="float:left">  
  67.                       <table width="100%" border="0" cellspacing="0" cellpadding="0">  
  68.                           <tr>  
  69.                             <td width="30%" height="30" align="right">操作系统版本:</td>  
  70.                             <td height="30"><span class="black">${props['os.name']!} ${props['os.version']!}</span></td>  
  71.                         </tr>  
  72.                           <tr>  
  73.                             <td width="30%" height="30" align="right">操作系统类型:</td>  
  74.                             <td height="30"><span class="black">${props['os.arch']!} ${props['sun.arch.data.model']!}位</span> </td>  
  75.                         </tr>  
  76.                           <tr>  
  77.                             <td width="30%" height="30" align="right">用户、目录、临时目录:</td>  
  78.                             <td height="30"><span class="black">${props['user.name']!}, ${props['user.dir']!}, ${props['java.io.tmpdir']!}</span></td>  
  79.                         </tr><tr>  
  80.                             <td width="30%" height="30" align="right">JAVA运行环境:</td>  
  81.                             <td height="30"><span>${props['java.runtime.name']!} ${props['java.runtime.version']!}</span></td>  
  82.                           </tr>  
  83.                           <tr>  
  84.                             <td width="30%" height="30" align="right">JAVA虚拟机:</td>  
  85.                             <td height="30"> <span>${props['java.vm.name']!} ${props['java.vm.version']!}</span></td>  
  86.                         </tr>  
  87.                    </table>    
  88.                </div>  
  89.   
  90.              </div>  
  91.                
  92.   </div>  
  93. </body>  
  94. </html>  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>jeecms-left</title>
<#include "/jeecms_sys/head.html"/>
</head>
<body>
  	    <div class="box-positon">
        	 <h1><@s.m "global.position"/>: <@s.m "global.admin.home"/> - <@s.m "global.admin.index"/></h1>
        </div>
<div class="body-box">
        <div class="welcom-con">
        	 <div class="we-txt">
             	  <p>
                  欢迎使用JEECMS内容管理系统!<br />
                  JEECMS程序版本: jeecmsv5.0 【<a href="http://www.jeecms.com" target="_blank">查看最新版本</a>】<br />
                  您上次登录的时间是:${user.lastLoginTime?string('yyyy-MM-dd')}<br />
                  已用内存:<span style="color:#0078ff;">${(usedMemory/1024/1024)?string("0.##")}MB</span>    剩余内存:<span style="color:#ff8400;">${(useableMemory/1024/1024)?string("0.##")}MB </span>    最大内存:<span style="color:#00ac41;">${(maxMemory/1024/1024)?string("0.##")}MB</span>
                  </p>
             </div>
             <ul class="ms">
             	<li class="wxx">访问量</li><li class="attribute">   系统属性</li>
             </ul>
             <div class="ms-xx">
                 <div class="xx-xx">
             	      <table width="100%" border="0" cellspacing="0" cellpadding="0">
             	       <tr>
                        <td width="20%" height="30" align="right"></td>
                        <td width="25%"><b>PV</b></td>
                        <td width="25%"><b>IP</b></td>
                        <td width="30%"><b>独立访客</b></td>
                    </tr>
                      <tr>
                        <td height="30" align="right">今日:</td>
                        <#list flowMap['today'] as f>
                     	<td>${f.count}</td>
                     	</#list>
                    </tr>
                      <tr>
                        <td height="30" align="right">昨日:</td>
                        <#list flowMap['yesterday'] as f>
                     	<td>${f.count}</td>
                     	</#list>
                    </tr>
                      <tr>
                        <td height="30" align="right">本周:</td>
                        <#list flowMap['thisweek'] as f>
                     	<td>${f.count}</td>
                     	</#list>
                    </tr>
                      <tr>
                        <td height="30" align="right">本月:</td>
                        <#list flowMap['thismonth'] as f>
                     	<td>${f.count}</td>
                     	</#list>
                     </tr>
                     <tr>
                        <td height="30" align="right">累计:</td>
                        <#list flowMap['total'] as f>
                     	<td>${f.count}</td>
                     	</#list>
                     </tr>
               </table>
                 </div>
                 <div class="attribute-xx" style="float:left">
                 	  <table width="100%" border="0" cellspacing="0" cellpadding="0">
                          <tr>
                            <td width="30%" height="30" align="right">操作系统版本:</td>
                            <td height="30"><span class="black">${props['os.name']!} ${props['os.version']!}</span></td>
                        </tr>
                          <tr>
                            <td width="30%" height="30" align="right">操作系统类型:</td>
                            <td height="30"><span class="black">${props['os.arch']!} ${props['sun.arch.data.model']!}位</span> </td>
                        </tr>
                          <tr>
                            <td width="30%" height="30" align="right">用户、目录、临时目录:</td>
                            <td height="30"><span class="black">${props['user.name']!}, ${props['user.dir']!}, ${props['java.io.tmpdir']!}</span></td>
                        </tr><tr>
                            <td width="30%" height="30" align="right">JAVA运行环境:</td>
                            <td height="30"><span>${props['java.runtime.name']!} ${props['java.runtime.version']!}</span></td>
                          </tr>
                          <tr>
                            <td width="30%" height="30" align="right">JAVA虚拟机:</td>
                            <td height="30"> <span>${props['java.vm.name']!} ${props['java.vm.version']!}</span></td>
                        </tr>
                   </table>  
               </div>

             </div>
             
  </div>
</body>
</html>


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

LiTianao88

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值