diff options
-rw-r--r-- | src/net/java/sip/communicator/launcher/SIPCommunicatorJWS.java | 42 | ||||
-rw-r--r-- | web-start/client.jnlp_template | 10 |
2 files changed, 52 insertions, 0 deletions
diff --git a/src/net/java/sip/communicator/launcher/SIPCommunicatorJWS.java b/src/net/java/sip/communicator/launcher/SIPCommunicatorJWS.java index 51c02c4..0ba3dd9 100644 --- a/src/net/java/sip/communicator/launcher/SIPCommunicatorJWS.java +++ b/src/net/java/sip/communicator/launcher/SIPCommunicatorJWS.java @@ -23,6 +23,48 @@ public class SIPCommunicatorJWS // allow access to everything System.setSecurityManager(null); + // optional: the name of another class with a main method + // that should be started in the same JVM: + String chainMain = System.getProperty("chain.main.class"); + if(chainMain != null) + { + // optional: a space-separated list of arguments to be passed + // to the chained main() method: + String chainArgs = System.getProperty("chain.main.args"); + if(chainArgs == null) + { + chainArgs = ""; + } + final String[] _chainArgs = chainArgs.split("\\s"); + try + { + Class<?> c = Class.forName(chainMain); + final Method m = c.getMethod("main", _chainArgs.getClass()); + new Thread() + { + public void run() + { + try + { + m.invoke(null, new Object[]{_chainArgs}); + } + catch (Exception ex) + { + ex.printStackTrace(); + System.err.println("Exception running the " + + "chained main class, will continue anyway."); + } + } + }.start(); + } + catch (Exception ex) + { + ex.printStackTrace(); + System.err.println("Exception finding the chained main " + + "class, will continue anyway."); + } + } + // prepare the logger // needed by the FileHandler-Logger SIPCommunicator.setScHomeDir(System.getProperty("os.name")); diff --git a/web-start/client.jnlp_template b/web-start/client.jnlp_template index 58079dd..b58519f 100644 --- a/web-start/client.jnlp_template +++ b/web-start/client.jnlp_template @@ -83,6 +83,11 @@ <resources> <j2se version="1.6+" href="http://java.sun.com/products/autodl/j2se"/> <property name="net.java.sip.communicator.SC_JWS_BASEDIR" value="@URL@"/> + <!-- to run an additional application in the same JVM, + declare the main class and any arguments here and + add the JARs to the list below. --> + <!-- <property name="chain.main.class" value="com.example.MyApp"/> --> + <!-- <property name="chain.main.args" value="arg1 arg2"/> --> <!-- INTERNAL_COMMENT Use compressed Jars if available --> <property name="jnlp.packEnabled" value="@PACKENABLED@"/> @@ -95,6 +100,11 @@ <jar href="lib/bundle/log4j.jar" /> <jar href="lib/bundle/commons-logging.jar" /> @COMMON@ + + <!-- here, add any other JARs that are needed for + a chained main class or any other purpose --> + <!-- <jar href="com.example.foo.jar" /> --> + </resources> <application-desc main-class="net.java.sip.communicator.launcher.SIPCommunicatorJWS"/> |