954,536 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How to Find System Info Through Java

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++

Ghost
Posting Whiz
352 posts since Aug 2004
Reputation Points: 12
Solved Threads: 2
 

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++

Hello,

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

aj.wh.ca
Junior Poster in Training
53 posts since Mar 2005
Reputation Points: 12
Solved Threads: 1
 

thank you very much.

Ghost
Posting Whiz
352 posts since Aug 2004
Reputation Points: 12
Solved Threads: 2
 

can you please tell me the methods i should use? Thanx

Ghost
Posting Whiz
352 posts since Aug 2004
Reputation Points: 12
Solved Threads: 2
 

please regard my last message - i figured it out. Is there a way to find the temperature of the cpu?

thanx

Ghost
Posting Whiz
352 posts since Aug 2004
Reputation Points: 12
Solved Threads: 2
 

please regard my last message - i figured it out. Is there a way to find the temperature of the cpu?

thanx


Thermometer?

server_crash
Postaholic
2,111 posts since Jun 2004
Reputation Points: 113
Solved Threads: 20
 

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.

jwenting
duckman
Team Colleague
8,392 posts since Nov 2004
Reputation Points: 1,662
Solved Threads: 337
 

can u further explain that?

thanx

Ghost
Posting Whiz
352 posts since Aug 2004
Reputation Points: 12
Solved Threads: 2
 

send me code which finds sytem information in java

kanna999666333
Newbie Poster
1 post since May 2009
Reputation Points: 10
Solved Threads: 0
 
send me code which finds sytem information in java

try using this:

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):

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 ..

jaka.ramdani
Newbie Poster
18 posts since Sep 2008
Reputation Points: 9
Solved Threads: 3
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You