| | |
How to Find System Info Through Java
![]() |
•
•
Join Date: Mar 2005
Posts: 53
Reputation:
Solved Threads: 1
•
•
•
•
Originally Posted by C++
Hi everybody;
is there a way to find system info (current time, date, processor speed, processor's RPM, Fan1's RPM, Fan2's RPM, etc)?
I am making a program that gives you information about your computer.
Thanx in advanced,
C++
The basic system info could be fetched using the java.lang.runtime class. It allows you to fetch number of CPU , available memory etc.
Also there is a System class which allows you to check the environmental variables.
Current time and date is easy to fetch using the Date class in java.util
Also if you are not concerned for a generic solution you can always fetch the required info using JNI. (I am not sure but I think the kind of specs you need would only be accessible using JNI)
cheers,
aj.wh.ca
Not unless you use JNI to drive a DLL which calls whatever service your machine has running to measure the CPU temperature.
There may be 3rd party libraries doing at least some of the coding for you.
There may be 3rd party libraries doing at least some of the coding for you.
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
•
•
Join Date: Sep 2008
Posts: 13
Reputation:
Solved Threads: 2
try using this:
in my system, it will print something like these (no masking since i don't think it will endangered me, lol):
hope will help ..
Java Syntax (Toggle Plain Text)
import java.util.Map.Entry; import java.util.Properties; import java.util.Set; public class Foo { public static void main(String args[]) { Properties systemProps = System.getProperties(); Set<Entry<Object, Object>> sets = systemProps.entrySet(); System.out.println("systems properties:"); for(Entry<Object,Object> entry : sets) { System.out.println("name: " + entry.getKey() + ", value: " + entry.getValue()); } } }
in my system, it will print something like these (no masking since i don't think it will endangered me, lol):
Java Syntax (Toggle Plain Text)
systems properties: name: java.runtime.name, value: Java(TM) SE Runtime Environment name: sun.boot.library.path, value: C:\DevTools\jdk1.6.0_05\jre\bin name: java.vm.version, value: 10.0-b19 name: java.vm.vendor, value: Sun Microsystems Inc. name: java.vendor.url, value: http://java.sun.com/ name: path.separator, value: ; name: java.vm.name, value: Java HotSpot(TM) Client VM name: file.encoding.pkg, value: sun.io name: sun.java.launcher, value: SUN_STANDARD name: user.country, value: ID name: sun.os.patch.level, value: Service Pack 2 name: java.vm.specification.name, value: Java Virtual Machine Specification name: user.dir, value: C:\Projects\personal\manga-downloader name: java.runtime.version, value: 1.6.0_05-b13 name: java.awt.graphicsenv, value: sun.awt.Win32GraphicsEnvironment name: java.endorsed.dirs, value: C:\DevTools\jdk1.6.0_05\jre\lib\endorsed name: os.arch, value: x86 name: java.io.tmpdir, value: C:\DOCUME~1\jaka\LOCALS~1\Temp\ name: line.separator, value: name: java.vm.specification.vendor, value: Sun Microsystems Inc. name: user.variant, value: name: os.name, value: Windows XP name: sun.jnu.encoding, value: Cp1252 name: java.library.path, value: C:\DevTools\jdk1.6.0_05\jre\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\DevTools\jdk1.6.0_05\bin;c:\DevTools\OpenSSL\bin\ name: java.specification.name, value: Java Platform API Specification name: java.class.version, value: 50.0 name: sun.management.compiler, value: HotSpot Client Compiler name: os.version, value: 5.1 name: user.home, value: C:\Documents and Settings\jaka name: user.timezone, value: name: java.awt.printerjob, value: sun.awt.windows.WPrinterJob name: file.encoding, value: Cp1252 name: java.specification.version, value: 1.6 name: java.class.path, value: C:\Projects\personal\manga-downloader\lib\htmlcleaner2_0.jar;C:\Projects\personal\manga-downloader\lib\htmlparser.jar;C:\Projects\personal\manga-downloader\lib\js.jar;C:\Projects\personal\manga-downloader\lib\slf4j-api-1.4.3.jar;C:\Projects\personal\manga-downloader\lib\slf4j-simple-1.4.3.jar;C:\Projects\personal\manga-downloader\lib\derbyclient.jar;C:\Projects\personal\manga-downloader\lib\dom4j-1.6.1.jar;C:\Projects\personal\manga-downloader\lib\jaxen-1.1-beta-7.jar;C:\Projects\personal\manga-downloader\lib\jdbc-x.jar;C:\Projects\personal\manga-downloader\lib\log4j-1.2.14.jar;C:\Projects\personal\manga-downloader\lib\slf4j-api-1.5.2.jar;C:\Projects\personal\manga-downloader\lib\slf4j-log4j12-1.5.2.jar;C:\Projects\personal\manga-downloader\build\classes name: user.name, value: jaka name: java.vm.specification.version, value: 1.0 name: java.home, value: C:\DevTools\jdk1.6.0_05\jre name: sun.arch.data.model, value: 32 name: user.language, value: in name: java.specification.vendor, value: Sun Microsystems Inc. name: awt.toolkit, value: sun.awt.windows.WToolkit name: java.vm.info, value: mixed mode, sharing name: java.version, value: 1.6.0_05 name: java.ext.dirs, value: C:\DevTools\jdk1.6.0_05\jre\lib\ext;C:\WINDOWS\Sun\Java\lib\ext name: sun.boot.class.path, value: C:\DevTools\jdk1.6.0_05\jre\lib\resources.jar;C:\DevTools\jdk1.6.0_05\jre\lib\rt.jar;C:\DevTools\jdk1.6.0_05\jre\lib\sunrsasign.jar;C:\DevTools\jdk1.6.0_05\jre\lib\jsse.jar;C:\DevTools\jdk1.6.0_05\jre\lib\jce.jar;C:\DevTools\jdk1.6.0_05\jre\lib\charsets.jar;C:\DevTools\jdk1.6.0_05\jre\classes name: java.vendor, value: Sun Microsystems Inc. name: file.separator, value: \ name: java.vendor.url.bug, value: http://java.sun.com/cgi-bin/bugreport.cgi name: sun.io.unicode.encoding, value: UnicodeLittle name: sun.cpu.endian, value: little name: sun.desktop, value: windows name: sun.cpu.isalist, value: pentium_pro+mmx pentium_pro pentium+mmx pentium i486 i386 i86
hope will help ..
![]() |
Other Threads in the Java Forum
- Previous Thread: Gadget Creation
- Next Thread: How to program under linux
| Thread Tools | Search this Thread |
2dgraphics 3d @param affinetransform android api applet application arc arguments array arrays automation banking binary bluetooth byte chat chatprogramusingobjects class client code color compare component count database design detection eclipse eclipsedevelopment encryption error fractal game givemetehcodez graphics gridlayout gui guitesting helpwithhomework html ide if_statement image input integer interface j2me java java.xls javadesktopapplications javaprojects jni jpanel julia keytool keyword linux list loop macintosh map method methods mobile netbeans newbie object os pong problem producer program programming project projectideas read recursion reference replaysolutions rim scanner server set size sms sort sql string swing terminal threads transforms tree ui unicode validation web windows






