tags:

views:

22

answers:

2

i run the osgi using the java command: java -jar org.eclipse.osgi_3.5.1.R35x_v20090827.jar -console and then the bundles could be find in the ./plugins directory.

There are 2 questions. (1)I just edited 1 class file in the local machine and transfered it to the remote server. so I want to osgi just load the classes not the jar. how should I do it ? if the osgi framework didn't support this feature. I must package the jar which has only one class file edited and transfer it to remote server. it is to slow to package it and transfer the whole jar.

(2)when I run the command in background. how could I get the osgi console again?

A: 

There might be non-standard ways to load classes, but there is no ways to do that with pure OSGi. In OSGi the bundle (the jar file) is the delivery package that can be loaded and managed by an OSGi framework. Usually, each bundle is loaded by an separate classloader. You gain a lot with that: you specify which packages with which version a bundle exports or imports. In the Manifest you indicate these relationships in an orderly manner. This ways the OSGi framework is able to manage the dependencies without interrupting other bundles.

akr
A: 

If you are trying to replace the class for debugging purposes, you could try a remote debug on a VM that supports hot code replace. This will allow you to step through, find a problem, and fix it without restarting OSGi.

Once you find the fix though, you will need to rebuild the bundle. @akr is correct that the packaging mechanism for OSGi is bundles.

To answer your second question, don't run it in the background if you want the console. Just run the command in its own shell. At development time, this shouldn't be a problem. At deployment time, you shouldn't really be using the console to do things. Technologies like P2 from Eclipse can help with managing deployed OSGi runtimes.

James Branigan