0

I am currently working on a local proxyserver in Java, now to prevent any work for the user I want to set the system-wide proxy settings to the local proxy server using my code.

I tried using;

System.setProperty("http.proxyHost", "localhost");
System.setProperty("http.proxyPort", "10001");

System.setProperty("proxySet", "true");

But if I am correct these are just the settings for the JVM?

How can I achieve setting a system-wide proxy?

Thizzer
  • 16,153
  • 28
  • 98
  • 139

1 Answers1

1

The solution was different for each platform, I currently only implemented the proxy settings on Windows and OSX.

  • Modify the preferences.plist file on OSX, this is the file located at

/Library/Preferences/SystemConfiguration/preferences.plist

  • Modify the registry on Windows, editing the following path

Software\Microsoft\Windows\CurrentVersion\Internet Settings

Thizzer
  • 16,153
  • 28
  • 98
  • 139
  • 2
    for linux/Solaris or any platform you could just use `_JAVA_OPTIONS` environment variable as explained here : http://stackoverflow.com/a/2966629/1503505 – Preuk May 11 '15 at 11:28