I have a NetBeans OSGi maven project that needs to run a class method from another OSGi jar which is loaded at runtime from the filesystem.
I tried looking at some of these similiar questions:
java: is there a framework that allows dynamically loading and unloading of jars (but not osgi)?
How to dynamically load Java classes at Runtime in OSGI framework?
but non of them seems to answer how I can access a method in the bundle I am loading.
they do seem to give me a good direction on how to load the bundle, but so does the documentation on OSGi. what i didn't find is how to run a specific method from a specific class in the bundle I installed. reflection does not seem to work and I have read that it might not be a good idea and in any case it gives me the famous ClassNotFoundException.
there is also the whole Manifest import and export as shown in this and other questions OSGi: programmitically add imports to a bundle
I cannot use bndtools, since I am using netbeans, also I'm not sure if it does the job. I am also not sure if OSGi services have anything to do with it.
Thanks in advance to anyone helping me not to pull my hair out :)