Hi Mahammad,

The first way you metioned is the way OSGi recommended.

In the second way, you could put these classes in the bootstrap classloader, 
and let system bundle exported these classes.  Then all of bundles in the 
framework could access them.  I didn't like this way,  because these classes in 
system bundle could be effected by extend environment,  and these classes 
couldn't be managed by OSGi,  so we couldn't get hot-plugin feature.

BTW,  you said : 'if a jar files is changed. i have to modify all the 
application and manifest',

It is not the problem for we putting classes into system bundle.  you should 
make an abstract interface layer to prevent this problem.  If you don't do 
this,  whatever you put classes into bundle of into system bundle, this problem 
will always let you feel sick.

In my opition,  if you want to do something under OSGi,  please put everything 
into bundle,  it could prevent problems in the future.

Good Luck.


2010-07-11 



Xu Huisheng 



发件人: Mahammad Nasir 
发送时间: 2010-07-10  23:45:36 
收件人: users 
抄送: 
主题: Sharing the jar files across all the application 
 
Hi,

I have 5-6 non osgi jar files (Not budle). And i have many application
bundles which uses this jar file. I want to know what is the best way to
share these jar files acros all the applications.

I can think of,

1) collect all the jar files and make this one bundle and load this in osgi
and other applications can now access it. (But, for some reason i dont want
to do this)
2) add the jars to class path of all the bundle. Problem with this is if a
jar files is changed. i have to modify all the application and manifest.


Is there any other better way of doing this? does osgi allow 2 dofferent
version of non-osgi jar files to load by two diffrent application?


Thanks Nasir

Reply via email to