selenium - Java: Modify System properties via runtime -


I have an existing jar file that I run This is Selenium RC server. I want to be able to change JVM httpProxy.host/port/etc system values. On one side, I can modify the source and add this feature to it. It will take some time. Another possible way to do this? Just like my own jar (which will establish these JVM properties), call Selenium RC inside a single JVM example (in this way it will be able to modify the values ​​of its JVM variable)?

You can define system properties on the command line,

  -DpropertyName = propertyValue  

then you can type

  java -jar selenium-rc.jar -Dhttp.proxyHost = your proxy host -Dhttp.proxyPort = See YourProxyPort  

,

Edit:

You can write an appendix that can be an application launcher. Using the reflection is easy to simulate easily by calling the main method in a class, then you can add system properties through System.setProperty before launching the final code. Can set. For example,

  public class's AppWrapper {/ * args [0] - to launch a class * / static void main (string [] args) app = class. Fornum (Argos [0]); Method main = app.getDeclaredMethod ("main", new class [] {(new string [1]). GetClass ()}); String [] appArgs = new string [args.length-1]; System ArrayCopy (args, 1, apparps, 0, apparps. Lamps); System.setProperty ("http.proxyHost", "someHost"); Main.invoke (empty, apparg); }}  

Comments