标签:charset etop shm rand JetBrains x86 available nvidia resource
一、JAVA中获取JVM的信息
原理,利用JavaSDK自带的ManagementFactory类来获取。
二、获取信息
1、获取进程ID
@Test public void test1() { RuntimeMXBean mxb = ManagementFactory.getRuntimeMXBean(); System.out.println(mxb.getName()); //2668@Sindrol-PC }
2、获取ManagementFactory.getRuntimeMXBean()的其它信息
RuntimeMXBean mxb = ManagementFactory.getRuntimeMXBean();
mxb.getSystemProperties() = {HashMap@866} size = 56 mxb.getInputArguments() = {Collections$UnmodifiableRandomAccessList@1039} size = 5 mxb.getBootClassPath() = "C:\Program Files\Java\jdk1.8.0_161\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_161\jre\lib\rt.jar;C:\Program Files\Java\jdk1.8.0_161\jre\lib\sunrsasign.jar;C:\Program Files\Java\jdk1.8.0_161\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_161\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_161\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_161\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_161\jre\classes;D:\Applicaton\DevTools\JetBrains\IntelliJIDEA\lib\rt\debugger-agent-storage.jar" mxb.getLibraryPath() = "C:\Program Files\Java\jdk1.8.0_161\bin;C:\windows\Sun\Java\bin;C:\windows\system32;C:\windows;C:\Program Files\Docker\Docker\Resources\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\libnvvp;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\lib\x64;D:\Applicaton\DevTools\Python\3.5\Scripts\;D:\Applicaton\DevTools\Python\3.5\;D:\Applicaton\DevTools\cudnn-8.0-windows10-x64-v5.1\cuda;D:\Applicaton\DevTools\cudnn-8.0-windows10-x64-v5.1\cuda\bin;D:\Applicaton\DevTools\cudnn-8.0-windows10-x64-v5.1\cuda\lib\x64;D:\Applicaton\DevTools\cudnn-8.0-windows10-x64-v5.1\cuda\lib;C:\Program Files (x86)\Common Files\NetSarang;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Microsoft SDKs\Azure\CL" mxb.getClassPath() = "D:\Applicaton\DevTools\JetBrains\IntelliJIDEA\lib\idea_rt.jar;D:\Applicaton\DevTools\JetBrains\IntelliJIDEA\plugins\junit\lib\junit-rt.jar;D:\Applicaton\DevTools\JetBrains\IntelliJIDEA\plugins\junit\lib\junit5-rt.jar;C:\Program Files\Java\jdk1.8.0_161\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_161\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_161\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_161\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_161\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_161\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_161\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_161\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_161\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_161\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_161\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_161\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_161\jre\lib\ext\sunpkcs11.jar;C:\Pr" mxb.getManagementSpecVersion() = "1.2" mxb.getSpecName() = "Java Virtual Machine Specification" mxb.getSpecVendor() = "Oracle Corporation" mxb.getStartTime() = 1527587462275 mxb.getUptime() = 95372 mxb.getVmVendor() = "Oracle Corporation" mxb.getObjectName() = {ObjectName@1052} "java.lang:type=Runtime" mxb.getName() = "2668@Sindrol-NTB"
3、获取操作系统信息
@Test public void test2() { OperatingSystemMXBean osb = ManagementFactory.getOperatingSystemMXBean(); System.out.println(osb.getName()); //Windows 10 System.out.println(osb.getArch()); //amd 64 System.out.println(osb.getAvailableProcessors()); //4 System.out.println(osb.getVersion()); //10.0 System.out.println(osb.getSystemLoadAverage()); //-1.0 }
标签:charset etop shm rand JetBrains x86 available nvidia resource
原文地址:https://www.cnblogs.com/songxingzhu/p/9106394.html