URGENT: Passing system properties to individual thread processes

Hi:

I'm trying to invoke multiple java Servers from a Controller class to enable starting all the servers in a single JVM. The code is shown below:

public class Controller {

/** Creates new Controller */

public Controller() {

}

/**

* @param args the command line arguments

*/

public static void main(String args[]) {

(new Thread(new Runnable() {

public void run() {

ChatServerRMI.Server.main(null);

}

})).start();

(new Thread(new Runnable() {

public void run() {

LoginService.LoginServerBaseImpl.main(null);

}

})).start();

}

}

However I want to pass system properties/arguments to each main() call. Can someone please explain me how this can be done.....ur help will be appreciated with D$s!

Thanks in advance.

[870 byte] By [compufreak10] at [2007-9-26 10:10:45]
# 1

If by "system properties" you mean the system properties accessible by System.getProperty("user.dir") and the like, you don't have to do anything to make those available to the threads. They are global and any piece of code can access them.

If you want to pass arguments to the various "main" methods as if they had been typed at the command line, you just make an array of strings with those arguments and use it as the parameter. For example:ChatServerRMI.Server.main(new String[] {"-port" "2023"});

And if you don't want to pass any parameters, do it like this:String[] nothing = new String[0];

LoginService.LoginServerBaseImpl.main(nothing);

DrClap at 2007-7-1 22:09:19 > top of Java-index,Java HotSpot Virtual Machine,Specifications...