# Launching using bndrun files

**URL:** <https://bnd.discourse.group/t/launching-using-bndrun-files/529>\
**Category:** GENERAL\
**Created:** [June 19, 2025, 12:05am UTC](https://bnd.discourse.group/t/launching-using-bndrun-files/529 "2025-06-19T00:05:19Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![scottslewis](https://yyz2.discourse-cdn.com/free1/user_avatar/bnd.discourse.group/scottslewis/32/63_2.png) [@scottslewis](https://bnd.discourse.group/u/scottslewis)\
**Post date:** [June 19, 2025, 12:05am UTC](https://bnd.discourse.group/t/launching-using-bndrun-files/529/1 "2025-06-19T00:05:19Z")

</div>

Is there a bnd or bndtools service to launch/run/debug a osgi framework programmatically…using a .bndrun file to specify the bundles/config/etc?

There is the bndrun editor in Eclipse, of course, which can also export to a executable jar, but I would prefer to launch my osgi framework process from another java app while in Eclipse workspace.

---

<div class="post-metadata">

**Author:** ![juergen-albert](https://yyz2.discourse-cdn.com/free1/user_avatar/bnd.discourse.group/juergen-albert/32/20_2.png) [@juergen-albert](https://bnd.discourse.group/u/juergen-albert)\
**Post date:** [June 19, 2025, 7:36am UTC](https://bnd.discourse.group/t/launching-using-bndrun-files/529/2 "2025-06-19T07:36:59Z")

</div>

Just to make sure I understand your correctly: You want to launch a e.g. plain Java App from Eclipse and this App then should launch a bndrun?

---

<div class="post-metadata">

**Author:** ![scottslewis](https://yyz2.discourse-cdn.com/free1/user_avatar/bnd.discourse.group/scottslewis/32/63_2.png) [@scottslewis](https://bnd.discourse.group/u/scottslewis)\
**Post date:** [June 19, 2025, 5:03pm UTC](https://bnd.discourse.group/t/launching-using-bndrun-files/529/3 "2025-06-19T17:03:57Z")

</div>

Yes that would do.

Since the post must be at least twenty characters…🙂

---

<div class="post-metadata">

**Author:** ![juergen-albert](https://yyz2.discourse-cdn.com/free1/user_avatar/bnd.discourse.group/juergen-albert/32/20_2.png) [@juergen-albert](https://bnd.discourse.group/u/juergen-albert)\
**Post date:** [June 20, 2025, 8:54am UTC](https://bnd.discourse.group/t/launching-using-bndrun-files/529/4 "2025-06-20T08:54:22Z")

</div>

If you have a Workspace with a cnf Project you can do the following:

```auto
try (Workspace ws = new Workspace(wsRoot); Bndrun bndrun = Bndrun.createBndrun(ws, bndrunFile)) {
			bndrun.run();
		}

```

---

<div class="post-metadata">

**Author:** ![scottslewis](https://yyz2.discourse-cdn.com/free1/user_avatar/bnd.discourse.group/scottslewis/32/63_2.png) [@scottslewis](https://bnd.discourse.group/u/scottslewis)\
**Post date:** [June 22, 2025, 11:55pm UTC](https://bnd.discourse.group/t/launching-using-bndrun-files/529/5 "2025-06-22T23:55:04Z")

</div>

Hi @juergen-albert

First, thanks for the Bndrun pointers…this is getting closer to what I’m looking for.

What I would like to have available would be something like what the output of the bndrun editor Export-\>Executable Jar-\>Directory exporter produces: a launch.properties with jars/\* bundles and aQute on classpath with start/start.bat.

Through debugging it seems that what the bndrun editor Run/Debug OSGi is actually very close to what I’m looking for…i.e. it generates a launch.properties file and passes a java command line that uses -Dlaunch.properties= /generated/launch722342354252435.properites file (in project/generated directory) launches the app (either in Run or Debug) and then after launched process exits it _deletes_ the generated/launch722342354252435.properties file.

I’m looking for something _in between_ the Run/Debug and Export behavior…i.e. it not only generates the launch.properties (as both do). It would be ideal if it generated the launch.properties (as the Run/Debug and Export do…hopefully with the same code…I haven’t debugged through/found that code yet so pointers would be appreciated) _and_ like the Export it actually copied the bundles and the aQute launcher code to new directories…perhaps in some project dir (like ‘build’) so that the contents could be copied and launched from outside Eclipse.

Also if the command line that the DebugPlugin.exec uses could be saved to this ‘build’ for later reference (i.e. the system properties…like -Dlaunch.properties=path and launch.directory) along with the fq main class (EmbeddedLauncher) that would be useful.

I was thinking that this could be automatically done by Run/Debug …perhaps _if_ a bndtools preference was set (that could define the ‘build’ directory), or there was some option set in the bndrun file. I’m not sure which would be more consistent with how bndtools works now wrt building.

Perhaps it already exists now…or I’m willing to help implement something like this if desired. I just need to be pointed to the relevant pieces in the Run/Debug and Export code.

---

<div class="post-metadata">

**Author:** ![kriegfrj](https://yyz2.discourse-cdn.com/free1/user_avatar/bnd.discourse.group/kriegfrj/32/24_2.png) [@kriegfrj](https://bnd.discourse.group/u/kriegfrj)\
**Post date:** [July 2, 2025, 1:10am UTC](https://bnd.discourse.group/t/launching-using-bndrun-files/529/6 "2025-07-02T01:10:01Z")

</div>

Did the [discussion on GitHub around exporting](https://github.com/bndtools/bnd/issues/6642) answer your question here, @scottslewis?

---

<div class="post-metadata">

**Author:** ![scottslewis](https://yyz2.discourse-cdn.com/free1/user_avatar/bnd.discourse.group/scottslewis/32/63_2.png) [@scottslewis](https://bnd.discourse.group/u/scottslewis)\
**Post date:** [July 2, 2025, 6:52pm UTC](https://bnd.discourse.group/t/launching-using-bndrun-files/529/7 "2025-07-02T18:52:09Z")

</div>

Yes it answered my question.

I think bndtools would be well-served to give more progressive disclosure in UI of bnd commands (including but not limited to export), but that’s for y’all to work out.
