Linked Questions

69 votes
3 answers
154k views

I was wondering if there is a way to get the computer name in Java? I have seen several answers that feature java.net.InetAddress. However I was wondering if there is a way that does not use the ...
dann.dev's user avatar
  • 2,503
0 votes
1 answer
150 views

Is there a way to extract the username logged into the network from a Java web-based application?
lilylove2shop's user avatar
0 votes
0 answers
57 views

So I have this program and I would want to have Java figure out the username by itself. import java.io.*; import java.nio.file.Files; public class Demo { public static void main(String[] args) ...
JScode's user avatar
  • 11
373 votes
13 answers
480k views

Which of the following is the best and most portable way to get the hostname of the current computer in Java? Runtime.getRuntime().exec("hostname") vs InetAddress.getLocalHost().getHostName()
Mahendra's user avatar
  • 3,867
40 votes
4 answers
93k views

So what I am trying to do is let my Java find the user's name that windows is logged in with, so when I would say such a method, it would return the users name, like I use it in the User called Noah, ...
Noah Cagle's user avatar
30 votes
4 answers
88k views

I'm making a peer-to-peer instant messaging application. Currently, if UserA.pool.net says "hello" to UserB.pool.net, User A sees "You: hello" and User B sees "UserA.pool.net: hello". Rather than ...
Matt's user avatar
  • 11.4k
3 votes
3 answers
3k views

I have a Selenium tests written in Java which runs as Jenkins job. I need to have chmod set up to 777 cause otherwise it throws me an error. But I would like to set up chmod properly to somenthing ...
Čamo's user avatar
  • 4,413
6 votes
2 answers
2k views

To get the name of the current user in a Java program, you can simply fetch the value of the user.name system property: System.getProperty("user.name"); But how secure is that? Can a user executing ...
Raedwald's user avatar
  • 49.2k
1 vote
2 answers
4k views

Problem: I am logging into a virtual machine(RDC) using the below credentials: The user is part of a domain group called as teldept user:147852 pass:helloworld when i try to get the user details ...
Wills's user avatar
  • 491
1 vote
1 answer
3k views

I´ve been stucked with this task for days now.. In the login form of my web application, before the user could enter the username and password, I want to receive in the request the username of his ...
Santiago's user avatar
0 votes
0 answers
1k views

I've created a play-java web application, with the default Application controller: package controllers; import play.*; import play.mvc.*; public class Application extends Controller { public ...
AmirTNinja's user avatar
0 votes
1 answer
759 views

I need get a network user name, but I don't know how! I try "System.getenv("USERNAME")", "System.getProperty("user.name")" and "new com.sun.security.auth.module.NTSystem().getName()", but didn'...
user3061516's user avatar
2 votes
2 answers
332 views

I am trying to find the current logged in username from Java. Process p; try { p = Runtime.getRuntime().exec("who -m"); p.waitFor(); BufferedReader reader = new BufferedReader(new ...
Karthik Andhamil's user avatar
-1 votes
1 answer
292 views

i need help trying todo this--> type variableName = new com.sun.security.auth.module.UnixSystem().getUsername() public class Main { public static String CodeKey="RAWW"; public ...
william's user avatar
0 votes
3 answers
217 views

When I executed my java class it turned out that I don't have some privileges when I try to access a file and I've got false: file.canRead() In order to get necessary rights I want to know who ...
Serhii Shevchyk's user avatar