Java Program to Get System Name for Windows and Linux Machine Last Updated : 05 Jul, 2021 Summarize Comments Improve Suggest changes Share Like Article Like Report We can get the System name for a Windows or Linux machine using the getHostName() method of the InetAddress class of java.net package after getting the IP address of the system using getLocalHost() method of the same class. The class InetAddress gets the IP address of any hostname. getLocalHost() method of the InetAddress class gets the address of the local host. getHostName() gets the hostname for a given IP address or returns the textual representation of the IP address if the operation is not allowed by the security manager. Syntax public String getHostName() Returns: The address of the host for a given IP address or the textual representation of the IP address if the operation is not allowed. Example: Java // Java program to demonstrate getting // the System name of the user import java.net.InetAddress; public class GFG { public static void main(String[] args) { try { // get system name String SystemName = InetAddress.getLocalHost().getHostName(); // SystemName stores the name of the system System.out.println("System Name : " + SystemName); } catch (Exception E) { System.err.println(E.getMessage()); } } } Output: Comment More infoAdvertise with us Next Article Java Program for Getting System UUID for Linux Machine M mharshita31 Follow Improve Article Tags : Java Java Programs Practice Tags : Java Similar Reads Java Program to Get System IP Address in Windows and Linux Machine IP Address: An Internet Protocol address is a numerical label assigned to each device connected to a computer network that uses the Internet Protocol for communication. Packages used: io (input-output): This package provides for system input and output through data streams, serialization, and the fi 2 min read Java Program to Get CPU Serial Number for Windows Machine CPU Serial Number (or Processor Serial Number) is a software-readable unique serial number that Intel has stamped into its Pentium 3 microprocessor. Intel offers this as a feature that can be optionally used to provide certain network management and e-commerce benefits. Basically, it lets a program 3 min read Java Program for Getting System UUID for Linux Machine Universally Unique Identifiers (UUIDs) are also known as Globally Unique Identifier(GUID) which are 128-bit numbers and are unique on all local systems they are created on also UUIDs created among other systems. Java UUID class is a part of java.util package. Java UUID class represents an immutable 4 min read Java Program to Open Input URL in System Default Browser in Windows URL is the URL you want to display in the default Web browser. For example, wire http://www.site.com/report.html to this input to display the HTML file report.html on the Web Server www.site.com in the browser. Our problem is to write a java program to open Input URL in System Default Browser in Win 2 min read Java Program to Determine the Name and Version of the Operating System The inbuilt System class in Java provides getProperty() method which is used to obtain the properties of the current working operating system. The System class has two versions of getProperty(). Both retrieve the value of the property named in the argument list. Methods: getProperty() version 1getPr 2 min read Java Program to Shut Down Computer in Linux In this program, we will shut down the Computer if the operating System is Linux. So, Firstly we will check that the System on which we are running Java Program is Linux or not. If the operating system is not Linux then we would not proceed further and print âUnsupported Operating Systemâ. If it is 2 min read Like