• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Get the IP dynamically

 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all
I am making a chat application in which i use JSP and Servlet
Now I have provided the normal login page that is in swing that calls the servlet and does the authentication with the server against databse

Now i would only be giving the swing gui to the client in a jar
But the IP that i pass while compiling and making a jar of swing client is static

Now every time the server changes i need to recompile the class file
Taking the case of yahoo that must be having many servers but the client never needs to specify the IP

Is there any way that my client can get the IP without me having to recompile it everytime before giving it to the client

Thanks
Regards
Monarch
 
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Usually no ip address is passed, instead a servername is used, so the
resolution of the address is done by the DNS.

But if you have resources that need to be read dynamically you can use
ResourceBundles.

This technique is usually applied to localize an application for
different languages, but you can use it for each information that
has to be stored outside of the class.

http://www.javaalmanac.com/egs/java.text/LocMsg.html
[ April 18, 2005: Message edited by: Jeffrey Spaulding ]
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you package and deliver your Swing app as an applet, you will have the getDocumentBase method available to you.

http://java.sun.com/j2se/1.4.2/docs/api/java/applet/Applet.html#getDocumentBase()
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic