From de3f60724c9059ee238fd00571314cb2d15ca15a Mon Sep 17 00:00:00 2001 From: Daniel Pocock Date: Thu, 7 Aug 2014 13:38:01 +0200 Subject: [PATCH] Handle the javaws command line arguments --- .../launcher/SIPCommunicatorJWS.java | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/src/net/java/sip/communicator/launcher/SIPCommunicatorJWS.java b/src/net/java/sip/communicator/launcher/SIPCommunicatorJWS.java index 0ba3dd916..0f4f8b3a7 100644 --- a/src/net/java/sip/communicator/launcher/SIPCommunicatorJWS.java +++ b/src/net/java/sip/communicator/launcher/SIPCommunicatorJWS.java @@ -176,7 +176,32 @@ public void run() { } + // Handle the "-open" argument from the javaws command line + Vector _args = new Vector(); + for(int i = 0; i < args.length ; i++) + { + String arg = args[i]; + if(arg.equalsIgnoreCase("-open")) + { + // are we at the last argument or is the next value + // some other option flag? + if(i == (args.length - 1) || + (args[i+1].length() > 0 && + "-/".indexOf(args[i+1].charAt(0))>=0)) + { + // invalid, can't use "-open" as final argument + System.err.println("Command line argument '-open'" + + " requires a parameter, usually a URI"); + System.exit(1); + } + } + else + { + _args.add(arg); + } + } + // launch the original app - SIPCommunicator.main(args); + SIPCommunicator.main(_args.toArray(new String[] {})); } }