Java program to get System Name for Windows or Linux Machine

Get System Name of Linux or Windows based Machine: This java program will get and print the system name of Linux or Windows Operating System based Machine.

package com.includehelp;


 * Program to get system Name for windows and Linux Machine
 * @author includehelp
public class SystemName {
     * Method for Get System Name
     * @return  System Name
    public static String getSystemName(){
            String systemName  =InetAddress.getLocalHost().getHostName();
            return systemName;    
	catch(Exception E){
            System.err.println("System Name Exp : "+E.getMessage());
            return null;
    public static void main(String[] args) {
        String SystmName = getSystemName();
        System.out.println("Computer Name : "+SystmName);


Computer Name : DESKTOP-13DO19X

Java Most Popular & Searched Programs »

Comments and Discussions!

Load comments ↻

Copyright © 2024 All rights reserved.