Online Training Spring Hibernate Training in Delhi R Programming Training Course Big Data and Hadoop Training Java Training

Java get windows Username

This page discusses - Java get windows Username

Ads

Tutorials   
Best Java Tutorial for Beginners Read user input in Java using Scanner Java Programming Examples Read file line by line in Java 8 What are the benefits of learning Java Programming? A brief history and future of Java programming language Importance of Java for Mobile Application Development How To Become A Good Software Developer? Learn Java Programming for beginners 5 Reasons Java is Still a Great Language to Boost Your Career Prospect as a Programmer How to learn Java with no programming experience? How to learn Java? What are Classes and Interfaces in Java? Converting a String to Integer in Java How to check if a string exists in a string in JavaScript? Installing JDK 8 on Windows 10 and configuring the settings Video Tutorial of reading file in Java 9 Invincible Reasons to learn Java New to Java programming Java Programming Tips, Articles and Notes How to download JDK 1.6? Encapsulation in Java Programming How to format number in Java? Generics Example Program in Java Java 9 Features Java 9 Tutorial, news and examples How to read content of JPEG file in Java? Image Processing Tutorials in Java Programming Language Introduction to Java Technology Java 8 Consumer Interface with forEach Loop Introduction to Generics in Java Java 8 consumer class(interface) example Oracle Launches Project Valhalla for Java How to read properties file in Java? How to add JDK 8 support in Eclipse? Java 8: Java 8 is officially released and it can be downloaded How to Invoke method using Reflection API of Java? First Lambda Expressions in Java Java 8 expected release date Lambda Expressions example in Eclipse JDK 8 Release Candidates Available Lambda Calculus Lambda Expression in Java 8 How to learn Java easily? Java made easy Oracle to release Java 8 in March 2014 Object Oriented Programming in Java Java Training Free Java beginners Course Easiest way to learn Java
Ads

Java get windows Username

     

In this section, you will learn how to obtain the window's username. We are providing you an example which will obtain the window's username by using the System.getProperty(). This will provide all the properties of the windows.

System.getProperty("user.name")- This method retrieve the username of the particular system from all the properties of Windows.

 

 

 

Here is the code of GetWindowUsername.java

public class GetWindowUsername {
public static final void main( String args[] ) {
String userName = System.getProperty("user.name");
System.out.println("Window's Username: "+userName);
}
}

Output will be displayed as:

Download Source Code

Advertisements

Share on Google+Share on Google+

Java get windows Username

Posted on: April 17, 2011 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Advertisements

Ads
 

Discuss: Java get windows Username  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0

Ads

 

Ads