2

I wanted to create runnable jar of Jitsi, one of the most popular SIP communicator. So, I have packaged Jitsi as a runnable jar. It can be used when this runnable jar is passed appropriate VM arguments, like:

-Dfelix.config.properties=file:lib/felix.client.run.properties
-Djava.util.logging.config.file=lib/logging.properties
-Dnet.java.sip.communicator.SC_HOME_DIR_NAME=Jitsi-dev

My Main class which invoke this runnable jar with those parameters looks like :

public class Main {  
    public static void main(String[] args) {  
        try {  
            Process p = Runtime.getRuntime().exec("java", 
                "-Dfelix.config.properties=file:lib/felix.client.run.properties", 
                "-Djava.util.logging.config.file=lib/logging.properties", 
                "-Dnet.java.sip.communicator.SC_HOME_DIR_NAME=Jitsi-dev, 
                "-jar", "jitsi.jar");  
        } catch (IOException e) {  
            e.printStackTrace();  
        }  
    }  
}

Of course in my jar you can also find those two properties files (felix.client.run.properties and logging.properties) in lib folder and also previously packed Jitsi in jitsi.jar. Unfortunately, I received an error that the config.properties via command line is not loaded. But when I make a shell script whuch runs jitsi.jar with the same parameters, I am able to run Jitsi. What is wrong with this above code ?

Thufir
  • 8,216
  • 28
  • 125
  • 273
Lukasz Ciesluk
  • 718
  • 1
  • 17
  • 29
  • Read (and implement) *all* the recommendations of [When Runtime.exec() won't](http://www.javaworld.com/jw-12-2000/jw-1229-traps.html). That might solve the problem. If not, it should provide more information as to the reason it failed. Then ignore that it refers to `exec` and build the `Process` using a `ProcessBuilder`. Also break a `String arg` into `String[] args` to account for arguments which themselves contain spaces. As an aside, that code looks like it would not compile, let alone run. It is missing a closing `"`. Don't waste people's time by posting 'something like' the code. – Andrew Thompson Jun 27 '14 at 10:36
  • is there some reason you don't simply run your code against Jitsi itself? Jitsi itself **is** runnable. – Thufir Jul 05 '14 at 04:43

0 Answers0