Source Code: 1.GetSystemDetails.java
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
import java.net.InetAddress;
import java.net.SocketException;
import java.net.UnknownHostException;
/**
*
* @author nande.m
*/
public class GetSystemDetails {
public static void main(String[] args) throws SocketException, UnknownHostException {
//get system name:
String computername = InetAddress.getLocalHost().getHostName();
System.out.println(computername);
//get ip address
InetAddress ownIP = InetAddress.getLocalHost();
System.out.println("IP of my system is := " + ownIP.getHostAddress());
}
} |
2.OSInfo.java
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
public class <strong>OSInfo</strong>{
public static void main(String[] args) {
String nameOS = "os.name";
String versionOS = "os.version";
String architectureOS = "os.arch";
System.out.println("::::The information about OS::::");
System.out.println("Name of the OS: "+ System.getProperty(nameOS));
System.out.println("Version of the OS: "+ System.getProperty(versionOS));
System.out.println("Architecture of THe OS: "+ System.getProperty(architectureOS));
}
}
//End of code...... |
What do you think of this post?Awesome (0) Interesting (0) Useful (0) Boring (0) Sucks (0)