慧 储
慧 储

Reputation: 29

How does Java use system proxy settings to access a website

I use a VPN client to access a website. My browers, like chrome, IE and firefox can all access the website. But java code, wget, curl cannot. Is there any setting for java to activate the function?

My VPN client is Jonus Pluse.

Upvotes: 0

Views: 713

Answers (2)

lafarer
lafarer

Reputation: 112

You can find the answer in the Java documentation.

Typically, you would use system properties:

java -Dhttp.proxyHost=10.0.0.100 -Dhttp.proxyPort=8800 ....

Upvotes: 0

JaskeyLam
JaskeyLam

Reputation: 15755

Try run your java application with :
java -Dhttp.proxyHost=webcache.example.com -Dhttp.proxyPort=8080;

Or set proxy before you get access to the network using HTTP:

System.setProperty("http.proxyHost", "webcache.example.com");
System.setProperty("http.proxyPort", "8080");

From: Java Networking and Proxies

Upvotes: 1

Related Questions