You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Srikanth Hugar <sr...@gmail.com> on 2014/12/12 09:31:46 UTC

How to launch new process in karaf?

How to create a new Process that executes a JAR (which is not a bundle)
inside karaf container?



We have a third party JAR file which is placed inside resources folder of a
bundle. Our requirement is to execute the JAR with a separate process . If
we create a Java Process using “ProcessBuilder” class , it is not able to
pick up JAR which is part of

a bundle. So one solution is to place the JAR file in System path instead
of inside a bundle.

We are looking for a solution where a new process can execute the JAR
available inside a bundle.

Re: How to launch new process in karaf?

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
The resources folder in a bundle doesn't mean anything if you don't 
define the OSGi headers.
Do you use Embed-Dependencies or so ?

Regards
JB

On 12/12/2014 09:31 AM, Srikanth Hugar wrote:
> How to create a new Process that executes a JAR (which is not a bundle)
> inside karaf container?
>
> We have a third party JAR file which is placed inside resources folder
> of a bundle. Our requirement is to execute the JAR with a separate
> process . If we create a Java Process using “ProcessBuilder” class , it
> is not able to pick up JAR which is part of
>
> a bundle. So one solution is to place the JAR file in System path
> instead of inside a bundle.
>
> We are looking for a solution where a new process can execute the JAR
> available inside a bundle.
>

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: How to launch new process in karaf?

Posted by ch...@kiffer.ltd.uk.
> How to create a new Process that executes a JAR (which is not a bundle)
> inside karaf container?

If you launch a command like
   java -jar path/to/file.jar
the JVM will want to find the jar file on the filesystem, so either you
need to make a temporary copy or (for extra points) mount your bundle as a
compressed filesystem. Since a jar file is just a fancy zip you should be
able to do this with fuse-zip (on Linux) or presumably WinMount on
Windows. Tricky bit will be to make sure it gets cleanly dismounted when
your application terminates.