My bundle contains a script(.bat and .sh) in the Resources folder. It is necessary to execute this script inside the bundle.
How could I achieve this in the OSGi world ? Example would be a.w.e.s.o.m.e
My bundle contains a script(.bat and .sh) in the Resources folder. It is necessary to execute this script inside the bundle.
How could I achieve this in the OSGi world ? Example would be a.w.e.s.o.m.e
I assume you script needs to do something when bundle becomes Active? In a bundle you can create an Activator (implement the BundleActivator interface) and have it run the scripts.
I'm not sure what your scripts do but personally I would not use scripts and try to do things differently.
To execute a script, you can use Runtime.exec(..) to launch a shell (sh, bash, etc..). These shells can execute a script that is either provided as a file, or read from standard input. The latter option can be leveraged here. Runtime.exec(..) returns a Process object, and you can obtain its input and output streams. Fetch the resource from your bundle as described here How do I access a file inside an OSGi bundle? and pass that data to your stream.