In the java program, I want to change socksProxyHost and socksProxyPort using the System.setProperty(String, String) method, but if I change the system property, will it be changed forever in the computer system?
Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
System Properties: Up until J2SE 1.4 system properties were the only way to set proxy servers within the Java networking API for any of the protocol handlers. To make matters more complicated, the names of these properties have changed from one release to another and some of them are now obsolete even if they are still supported for compatibility’s sake.
The major limitation of using system properties is that they are an “all or nothing” switch. Meaning that once a proxy has been set for a particular protocol, it will affect all connections for that protocol. It’s a VM wide behavior.
There are 2 main ways to set system properties:
As a command line option when invoking the VM
Using the System.setProperty(String, String) method, assuming, of course that you have permission to do so.