Reputation: 55
Iam developing an OSGI equinox launcher which should start the OSGI framework and equinox console.I have added the five jars in a folder called as plugin as a part of the classpath/buildpath but still iam unable to execute.
Below is the command which executes successfully on the linux console and opens the osgi> prompt on linux console.
java-Dosgi.bundles=org.eclipse.equinox.console_1.1.0.v20140131-1639.jar.@start,org.apache.felix.gogo.command_0.10.0.v201209301215.jar@start,org.apache.felix.gogo.runtime_0.10.0.v201209301036.jar@start,org.apache.felix.gogo.shell_0.10.0.v201212101605.jar@start -jar org.eclipse.osgi_3.10.0.v20140606-1445.jar -console
But the above fails in my code which is as below
public static void main(String[] args) {
String command ="java-Dosgi.bundles=plugin/org.eclipse.equinox.console_1.1.0.v20140131-1639.jar@start,plugin/org.apache.felix.gogo.command_0.10.0.v201209301215.jar@start,plugin/org.apache.felix.gogo.runtime_0.10.0.v201209301036.jar@start,plugin/org.apache.felix.gogo.shell_0.10.0.v201212101605.jar@start -jar plugin/org.eclipse.osgi_3.10.1.v20140909-1633.jar -console";
try {
// using the Runtime exec method:
Process p = Runtime.getRuntime().exec(command);
BufferedReader stdInput = new BufferedReader(new
InputStreamReader(p.getInputStream()));
BufferedReader stdError = new BufferedReader(new
InputStreamReader(p.getErrorStream()));
// read the output from the command
System.out.println("Here is the standard output of the command:\n");
while ((s = stdInput.readLine()) != null) {
System.out.println(s);
}
// read any errors from the attempted command
System.out.println("Here is the standard error of the command (if any):\n");
while ((s = stdError.readLine()) != null) {
System.out.println(s);
}
System.exit(0);
}
catch (IOException e) {
System.out.println("exception happened - here's what I know: ");
e.printStackTrace();
System.exit(-1);
}
}
The error is as below Here is the standard output of the command:
Here is the standard error of the command (if any):
Error: Unable to access jarfile plugin/org.eclipse.osgi_3.10.1.v20140909-1633.jar
Upvotes: -1
Views: 739
Reputation: 3732
The two commands (the one that is executing successfully on the Linux console and the one that fails in your code) are slightly different. In the first one you use
-jar org.eclipse.osgi_3.10.0.v20140606-1445.jar
while in the second
-jar plugin/org.eclipse.osgi_3.10.1.v20140909-1633.jar
Since the error message you get says that it cannot access plugin/org.eclipse.osgi_3.10.1.v20140909-1633.jar
I assume that this jar file does not exist which is why your command is failing.
Upvotes: 0