Hey everyone,
In a
java program how one can utilize the proxy that is already configured (on Windows, I assume it would be the same everywhere (write once, run... ?)).
Here is a demonstration of my issue:
1. Go to your Control Panel->Java and set a proxy address.
2. Run the following simple
applet code (I'm using the Eclipse
IDE):
import java.awt.Graphics;
import javax.swing.JApplet;
import java.util.*;
public class Ranchlet extends JApplet {
private
String message;
public void init(){
Properties props = System.getProperties();
message = props.getProperty("http.proxyHost", "NONE");
message = (message.length() == 0)? "NONE": message;
}
public void paint(Graphics g)
{
g.drawString(message, 20, 20);
}
}
The Applet displays "NONE" without regard to the settings you've placed in the Java Control Panel. What would be best would be if the Windows proxy settings (usually set in Internet Explorer) were what I could determine but doing an extra configuration step in the Java Control Panel would still be an acceptable solution.
Thanks!