java获取jdk、系统、服务器等信息

1、获取jdk信息

[java]  view plain copy

  1. <span style="font-size:18px;">System.out.println(System.getProperty("java.version"));
  2. System.out.println(System.getProperty("java.vendor"));
  3. System.out.println(System.getProperty("java.vendor.url"));
  4. System.out.println(System.getProperty("java.home"));
  5. System.out.println(System.getProperty("java.vm.specification.version"));
  6. System.out.println(System.getProperty("java.vm.specification.vendor"));
  7. System.out.println(System.getProperty("java.vm.specification.name"));
  8. System.out.println(System.getProperty("java.vm.version"));
  9. System.out.println(System.getProperty("java.vm.vendor"));
  10. System.out.println(System.getProperty("java.vm.name"));
  11. System.out.println(System.getProperty("java.specification.version"));
  12. System.out.println(System.getProperty("java.specification.vendor"));
  13. System.out.println(System.getProperty("java.specification.name"));
  14. System.out.println(System.getProperty("java.class.version"));
  15. System.out.println(System.getProperty("java.class.path"));
  16. System.out.println(System.getProperty("java.library.path"));
  17. System.out.println(System.getProperty("java.io.tmpdir"));
  18. System.out.println(System.getProperty("java.compiler"));
  19. System.out.println(System.getProperty("java.ext.dirs")); 

2、获取系统信息

[java]  view plain copy

  1. <span style="font-size:18px;">System.out.println(System.getProperty("os.name"));
  2. System.out.println(System.getProperty("os.arch"));
  3. System.out.println(System.getProperty("os.version"));
  4. System.out.println(System.getProperty("file.separator"));
  5. System.out.println(System.getProperty("path.separator"));
  6. System.out.println(System.getProperty("line.separator"));
  7. System.out.println(System.getProperty("user.name"));
  8. System.out.println(System.getProperty("user.home"));
  9. System.out.println(System.getProperty("user.dir")); 

3.获取Tomcat的版本 
<%= application.getServerInfo() %>

=========

几个常用Request.ServerVariables的中文 

本文件ip路径:<%="http://" & request.servervariables("server_name")&request.servervariables("script_name") %> 
本机ip:<%=request.servervariables("remote_addr")%> 
服务器名:<%=Request.ServerVariables("SERVER_NAME")%> 
服务器IP:<%=Request.ServerVariables("LOCAL_ADDR")%> 
服务器端口:<%=Request.ServerVariables("SERVER_PORT")%> 
服务器时间:<%=now%> 
IIS版本:<%=Request.ServerVariables("SERVER_SOFTWARE")%> 
脚本超时时间:<%=Server.ScriptTimeout%> 
本文件路径:<%=server.mappath(Request.ServerVariables("SCRIPT_NAME"))%> 
服务器CPU数量:<%=Request.ServerVariables("NUMBER_OF_PROCESSORS")%> 
服务器解译引擎:<%=ScriptEngine & "/"& ScriptEngineMajorVersion&"."&ScriptEngineMinorVersion&"."& ScriptEngineBuildVersion %> 
服务器操作系统:<%=Request.ServerVariables("OS")%> 
支持的文件类型:<%=Request.ServerVariables("HTTP_Accept")%> 
访问的文件路径:<%=Request.ServerVariables("HTTP_url")%> 
用户代理的信息:<%=Request.ServerVariables("HTTP_USER_AGENT")%> 
获取url中的文件名和传过来的值:request.ServerVariables("script_name")+"?"+request.ServerVariableS("QUERY_STRING")

评论

h
hw_7864

⭐️ Admin快速开发: https://show.cool-admin.com/

赞 0
h
hw_7864

⭐️ 官方文档: https://cool-js.com

赞 0
h
hw_7864

⭐️ chatgpt在线体验: https://cool-js.com/ai/chat-vip/index.html?r=helloworld

赞 0