Click here to Skip to main content
15,901,205 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

i written the following access the url..

with out proxy:

Java
String strUrl1 = "http://www.google.com";
            URL url = new URL(strUrl1.toString());
            URLConnection conn = url.openConnection(); 

its connecting..

but now i am using the proxy..
now also it directly connecting.


how?
Posted
Updated 5-Jun-12 1:16am
v2
Comments
Sandeep Mewara 5-Jun-12 7:25am    
And your question is?
@BangIndia 5-Jun-12 7:29am    
how it will access the url directly with out configuring any proxy setting for this code..
@BangIndia 5-Jun-12 9:35am    
do you have any answer for that.
krumia 10-Jun-12 7:33am    
Side note: Why are you calling toString() on an object which is already a String?

1 solution

Use the following option:

java -Dhttp.proxyHost=myproxyhost MyClass

Took it from http://edn.embarcadero.com/article/29783[^], which is the first link for searching Google with "using a proxy server in java".
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900