Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7792897
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T22:19:00+00:00 2026-06-01T22:19:00+00:00

I have a Java desktop application (deployed on Windows) that needs to know about

  • 0

I have a Java desktop application (deployed on Windows) that needs to know about a bunch of different hostnames/IPs. I prefer to use hostnames in the software, as it is more descriptive/less fragile than putting in IP addresses. However, this implies that the Windows machines need knowledge of this mapping.

Both the desktop application and the server software they are talking to are deployed inside a private network. There is no existing DNS service on the network that I am able to take advantage of.

The server software the desktops are talking to already have a hosts file defined with all of this information. In the past, I have included this hosts file with my desktop installer, and basically clobbered the Windows machine’s host file. That’s pretty ugly and I’d rather not do that again. I was hoping I could basically deploy my hosts file inside my desktop application, and run some kind of name service inside the application that is populated with the hosts file information. That way I don’t affect other applications, or mess with the desktop’s host file.

I found this article that describes implementing your own NameService class. This is the kind of solution I was looking for, however, it uses internal Sun classes (which I can get away with here, but I’d rather not have to). Also, the article is quite old (2006). In the Java 7 API, the network properties the article mentions are no longer listed. Is there a better/more modern way to do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T22:19:02+00:00Added an answer on June 1, 2026 at 10:19 pm

    I don’t understand the complexity, replacing NameServer classes etc.. If all you need is a couple of hostname-ip mapping, have an array with hostanames and IPs and lookup your names in that array. Or have a file formatted like hosts, put the file in your application folder and populate the aforementioned array from that file.

    The good solution would be to have a local DNS server though, like DNSMASQ or BIND.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a Windows Java desktop application that creates some configuration files at %APPDATA%
I have a java desktop application with information about several entities. There is a
I have Java Desktop application that displays some information in a JTable that contains
I have a Java desktop application, which needs to be updated with data from
I have Java desktop application that works with CSV files. And i want add
We have a Java desktop application that accesses a Derby database located on a
I have a Java Desktop Application project created with NetBeans. The icon that is
We have a java desktop application and we are planning to launch that java
I am creating a Java Desktop Application that is going to have a Firewall.
I have Java Desktop application that displays some information in a JTable that may

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.