Ethernet ID and system Info in Java  
Author Message
Ashwini Kumar





PostPosted: 2004-2-15 0:35:00 Top

java-programmer, Ethernet ID and system Info in Java Hi,

I want to know if there is a way to get system level information using Java.
I am mostly interested in things like Ethernet ID and serial number of Hard
disk. Some of the values when you type "ipconfig /all" on windows.

I know we can do all this using JNI with the main routines written in C. But
is there a way to do it using Java alone?. I have not seen any API to help
me get such deep system level information.

Thanking you,


 
HGA03630





PostPosted: 2004-2-15 18:29:00 Top

java-programmer >> Ethernet ID and system Info in Java "Ashwini Kumar" <email***@***.com> wrote in message news:<email***@***.com>...
> Hi,
>
> I want to know if there is a way to get system level information using Java.
> I am mostly interested in things like Ethernet ID and serial number of Hard
> disk. Some of the values when you type "ipconfig /all" on windows.
>
> I know we can do all this using JNI with the main routines written in C. But
> is there a way to do it using Java alone?. I have not seen any API to help
> me get such deep system level information.
>
> Thanking you,

Call a C program or an assembly language program from Runtime#exec()
and read the result from Process#getInputStream().
 
Tom N





PostPosted: 2004-2-26 16:38:00 Top

java-programmer >> Ethernet ID and system Info in Java "hiwa" wrote
> "Ashwini Kumar" wrote
> > Hi,
> >
> > I want to know if there is a way to get system level information using
Java.
> > I am mostly interested in things like Ethernet ID and serial number of
Hard
> > disk. Some of the values when you type "ipconfig /all" on windows.
> >
> > I know we can do all this using JNI with the main routines written in C.
But
> > is there a way to do it using Java alone?. I have not seen any API to
help
> > me get such deep system level information.
> >
> > Thanking you,
>
> Call a C program or an assembly language program from Runtime#exec()
> and read the result from Process#getInputStream().

IP address may vary if PC gets its IP from DHCP.

You can get the IP address fairly easily in Java (see InetAddress class) but
MAC address is not possible in Java (AFAIK).

There isn't a common Windows function in every version of Windows that gets
MAC address - there are actually many routines to get MAC address for
example; it depends on the version of Windows and what is installed. See
http://www.codeguru.com/network/GetMAC.html

I think the easiest way is to exec ipconfig (depending on how "professional"
it needs to look). MAC address can be modified (but not many people know
that).
See http://forum.java.sun.com/thread.jsp?forum=31&thread=46369

You can get hard disk's volume serial number from executing "dir". However
they are not unique e.g. disk cloning (commonly done by Sys admins to
configure new PCs in commercial environments) will copy it.