user2295575
user2295575

Reputation: 13

How to use java to set the IE proxy?

I have a Java proxy program which used to listen request from Internet Explorer, but when I start the program,I have to set the proxy in the browser's Internet setting. How can I set the browser's setting in the Java program automatically?

As I use the following way,but it didn't work.

   Properties prop = System.getProperties();
    prop.setProperty("http.proxyHost", "127.0.0.1");
    prop.setProperty("http.proxyPort", "3000");

Upvotes: 1

Views: 1104

Answers (2)

Stephen C
Stephen C

Reputation: 718708

This Microsoft Support links explains how to set the IE proxy settings in the registry. So to do this from Java, you would need to identify a suitable Java library for talking to the Windows Registry.


The way you tried has no chance of working. Your code is actually tweaking the proxy settings for the JVM's in-memory "system" properties. This affects nothing else.

Upvotes: 1

coolpal
coolpal

Reputation: 31

I don't think you can alter ie settings from java, and even if there are ways to alter system files (using trusted applets), it's not advisable. What you tried there is to set the proxy for java program to use by default.

Also, if I understand your problem correctly, you cannot reach the java program unless you set the proxy in your browser, so your java program might not even be an applet that is running inside ie, and as far as that program goes, it has no control over the ie instance.

Upvotes: 0

Related Questions