[英]Setting system-wide/global proxy in java
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. 我目前正在Java中使用本地代理服务器,现在是为了防止用户想要使用我的代码将系统范围的代理设置设置为本地代理服务器。
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? 但是,如果我正确的话,这些仅仅是JVM的设置吗?
How can I achieve setting a system-wide proxy? 如何实现设置系统范围的代理?
The solution was different for each platform, I currently only implemented the proxy settings on Windows and OSX. 每个平台的解决方案都不相同,我目前仅在Windows和OSX上实现了代理设置。
/Library/Preferences/SystemConfiguration/preferences.plist /Library/Preferences/SystemConfiguration/preferences.plist
Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings 软件\\ Microsoft \\ Windows \\ CurrentVersion \\ Internet设置
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.