0

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.

Rasto
  • 17,204
  • 47
  • 154
  • 245

2 Answers2

2

No, it will only affect the JVM and the current execution.

aioobe
  • 413,195
  • 112
  • 811
  • 826
0

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.

Mohammod Hossain
  • 4,134
  • 2
  • 26
  • 37