Get system information using java (embedded in the page)

Is there a way to get information about the system, for example, the processor / ram, etc. (preferably cross platform, in browser)?

I want to implement this on a website, so I need it either in a flash or in a java applet.

+4
source share
4 answers

Try this applet program.

import com.sun.servicetag.SystemEnvironment; import java.lang.management.ManagementFactory; public class Config extends java.applet.Applet{ public void paint(java.awt.Graphics g){ g.drawString("Hi.. This is Venkatesh..",50,10); SystemEnvironment se = SystemEnvironment.getSystemEnvironment(); g.drawString("CpuManufacturer:"+se.getCpuManufacturer(),50,40); g.drawString("HostID:"+se.getHostId(),50,60); g.drawString("Host Name:"+se.getHostname(),50,80); g.drawString("OS Architecture:"+se.getOsArchitecture(),50,100); g.drawString("OS Name:"+se.getOsName(),50,120); g.drawString("OS Verstion:"+se.getOsVersion(),50,140); g.drawString("Serial no:"+se.getSerialNumber(),50,160); g.drawString("System model:"+se.getSystemModel(),50,180); g.drawString("System Manufacturer:"+se.getSystemManufacturer(),50,200); com.sun.management.OperatingSystemMXBean mxbean = (com.sun.management.OperatingSystemMXBean)ManagementFactory.getOperatingSystemMXBean(); g.drawString("Available Processors:"+mxbean.getAvailableProcessors(),50,220); g.drawString("TotalRAM:"+mxbean.getTotalSwapSpaceSize()/(1024*1024*1024)+""+"GB",50,240); g.drawString("RAM SIZE :" + (mxbean.getTotalPhysicalMemorySize()/(1024*1024*1024))+ " GB ",50,260); } } <Applet Code="HelloWorld.class" width="150" height="150"> </Applet> 
+3
source

You can use SIGAR. http://support.hyperic.com/display/SIGAR/Home

Please note that it is licensed under the GPL. This may not suit you if you are not using it for an internal application or for an open source application.

+2
source

For RAM information, see this thread -> so use the java.lang.managament package or look at this or.

To get information about another RAM:

 Runtime.getRuntime().availableProcessors() Runtime.getRuntime().maxMemory(); 

Or get information about the OS, etc .:

 System.getProperties().list(System.out); 

SIGAR is apparently the only library available for this task.

+1
source

"Hi,

Java, I think, is a more restrictive version of the two, in terms of what you can pull from the client.

Flash will provide you with some information through the Capabilities class, it has slightly weaker security than Java, so I think this is the best choice.

 package { import flash.display.Sprite; import flash.system.Capabilities; public class CapabilitiesExample extends Sprite { public function CapabilitiesExample() { showCapabilities(); } private function showCapabilities():void { trace("avHardwareDisable: " + Capabilities.avHardwareDisable); trace("hasAccessibility: " + Capabilities.hasAccessibility); trace("hasAudio: " + Capabilities.hasAudio); trace("hasAudioEncoder: " + Capabilities.hasAudioEncoder); trace("hasEmbeddedVideo: " + Capabilities.hasEmbeddedVideo); trace("hasMP3: " + Capabilities.hasMP3); trace("hasPrinting: " + Capabilities.hasPrinting); trace("hasScreenBroadcast: " + Capabilities.hasScreenBroadcast); trace("hasScreenPlayback: " + Capabilities.hasScreenPlayback); trace("hasStreamingAudio: " + Capabilities.hasStreamingAudio); trace("hasVideoEncoder: " + Capabilities.hasVideoEncoder); trace("isDebugger: " + Capabilities.isDebugger); trace("language: " + Capabilities.language); trace("localFileReadDisable: " + Capabilities.localFileReadDisable); trace("manufacturer: " + Capabilities.manufacturer); trace("os: " + Capabilities.os); trace("pixelAspectRatio: " + Capabilities.pixelAspectRatio); trace("playerType: " + Capabilities.playerType); trace("screenColor: " + Capabilities.screenColor); trace("screenDPI: " + Capabilities.screenDPI); trace("screenResolutionX: " + Capabilities.screenResolutionX); trace("screenResolutionY: " + Capabilities.screenResolutionY); trace("serverString: " + Capabilities.serverString); trace("version: " + Capabilities.version); } } } 

Example from: http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/

To determine the speed, you need to do benchmarking.

Advice. By controlling, for example, the rendering / calculation time in javascript, flash or java, you can dynamically change the behavior of your application based on real performance, instead of running the test before launching the application (as I have seen others do). For example: Topic 1: Monitoring and changing data (for example, the degree of rotation in a rotating cube). Theme 2: Make heavy calculations and rendering.

(This is simple in Java with threads, but in flash, you need to do the processing and check the hard code using a monitor on how to proceed).

Tips 2: There are many publicly available tests, so you can narrow down which processors work by launching a benchmark and comparing the results with a database of results.

Hope this helps!

Greetings

+1
source

Source: https://habr.com/ru/post/1302865/


All Articles