Thank you Wim for confirming I was on the right path and for the suggestion to wrap it all in a static method and class.
Jonah ~~~ Jonah Graham Kichwa Coders www.kichwacoders.com On Thu, 15 Apr 2021 at 08:55, Wim Jongman <wim.jong...@gmail.com> wrote: > Yes, those are two good options. AFAIK there is no additional magic that > you miss. > > I would wrap the dependency checking in a static class. e.g use > if(DepBundleChecker.isAvailable()){ .. do something ..} instead of catching > class loading exceptions. It's a bit more elegant but it stays a pita. > > Cheers, > > Wim > > On Thu, Apr 15, 2021 at 1:39 PM Jonah Graham <jo...@kichwacoders.com> > wrote: > >> Hello, >> >> (Not sure this is on topic for the list - but not sure where to ask.) >> >> What is the canonical way to check if an optional dependency is available? >> >> I know of a couple of methods: >> >> 1. wrapping code in try/catch and catching something wide like Throwable >> or NoClassDefFoundError >> 2. checking for bundle status (e.g. calling >> Platform.getBundle(symbolicName) and Bundle.getState) >> >> Thank you. >> Jonah >> >> >> >> >> ~~~ >> Jonah Graham >> Kichwa Coders >> www.kichwacoders.com >> _______________________________________________ >> platform-dev mailing list >> platform-dev@eclipse.org >> To unsubscribe from this list, visit >> https://www.eclipse.org/mailman/listinfo/platform-dev >> > _______________________________________________ > platform-dev mailing list > platform-dev@eclipse.org > To unsubscribe from this list, visit > https://www.eclipse.org/mailman/listinfo/platform-dev >
_______________________________________________ platform-dev mailing list platform-dev@eclipse.org To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/platform-dev