File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting out of a proxy server

 
Guhan Ramanan
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello!
I have a proxyserver called PROXYSERVER and that is connected to the Net.
I tried the following code and it gave me a UnknownHostException. How do i resolve it?
// Code follows
import java.io.*;
import java.net.*;
import java.util.*;
class InetTest
{
public static void main(String args[]) throws Exception
{
Properties prop=System.getProperties();
prop.put("Http.proxyHost","PROXYSERVER");
prop.put("http.proxyPort","80");
Properties prop1=System.getProperties();
System.setProperties(prop1);
System.out.println(prop1);


InetAddress Address=InetAddress.getLocalHost();
String abcd=Address.getHostAddress();
//String abcd = InetAddress.getHostName();

System.out.println(abcd);
Address = InetAddress.getByName("www.hotmail.com");
System.out.println(Address);
}
}
I get local host name and the property has been added but still there is the exception.
Plz help..
-guhan
 
Sandeep Jain
Ranch Hand
Posts: 124
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Even I had the same problem earlier . But after installing the microsoft proxy client on to my system, the program worked perfectly without any problem .
Try installing the proxy client from ur server . Its a software that is available on the server . In case you are unable to undestand what is the funda behind the proxy client .Contact ur server administrator he will install it for u .

------------------
Sandeep Jain
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic