Linked Questions

0 votes
1 answer
459 views

When I try to get the hostname of my machine from the code, I'm using the following: address = InetAddress.getLocalHost().getCanonicalHostName(); The above throws an excpetion (UnknownHostException) ...
Maoritzio's user avatar
  • 1,242
0 votes
0 answers
72 views

Our lab uses several ruggedized military laptops in a closed-network business environment. These computers are running identical Windows 7 versions, networked with static IP's, running Apache Tomcat ...
MAbraham1's user avatar
  • 1,778
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
180 votes
4 answers
217k views

Is it possible to get the name of the currently logged in user (Windows/Unix) and the hostname of the machine? I assume it's just a property of some static environment class. I've found this for the ...
Omar Kooheji's user avatar
  • 55.9k
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
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
28 votes
5 answers
42k views

How can I obtain the physical machine name that my jvm is running in? (Physical = OS, up to vmware...) Added from poster's comment: I mean the name of the computer the JVM is running in. Most likely ...
ripper234's user avatar
  • 231k
24 votes
9 answers
20k views

We just upgraded to Java 8 on Amazon Linux. We are using Spring 4.3.8.RELEASE. It used to be that we could get our machine hostname by setting up beans in our application context file like so ... &...
Dave's user avatar
  • 20.1k
6 votes
2 answers
4k views

I am using Java to build a simple method within a class that will grab the LAN IPv4 address of the user's machine. For the most part this works well, with one exception... the IP address I get back is ...
Oliver Spryn's user avatar
  • 17.4k
2 votes
1 answer
8k views

I am trying to deploy my application using helm charts. I have defined a statefulSet as a kind under deployment.yaml and provided a headless service under spec.serviceName. Code snippet from ...
Nish's user avatar
  • 1,032
2 votes
3 answers
10k views

I am trying to get the host name off the server where it is running. Java code: import java.net.InetAddress; System.out.println("Host Name: " + InetAddress.getLocalHost().getHostName()); System....
Bishwarup Das's user avatar
2 votes
3 answers
5k views

What is the difference between System.getenv("computername") and System.getenv("hostname") in Java? Is there any character limit on the computer name when retrieving it using the getenv() method? I ...
user811433's user avatar
  • 4,179
0 votes
1 answer
10k views

I am trying to do hp fortify security scan for my java application. I have few issues and i have fixed it. But i am unable to find the fix for the below issue. Command Injection String hostname = ...
Vamshi's user avatar
  • 41
1 vote
4 answers
2k views

I'm making a plugin for my staff that can help them with some basic information. I'm trying to add a /ip for the server that will show the server ip, instead of the dns that they connect to. I'm ...
Kheera's user avatar
  • 21
1 vote
2 answers
5k views

I posted a question about a problem that concerns inetaddress in java 8 : InetAddress java 8 is not getting the hostname however I found a simple solution by using System.getenv("HOSTNAME") instead ...
Mohamed Taboubi's user avatar

15 30 50 per page