Java ServiceLoader can't find class

29 Views Asked by At

In the Jogamp Java3D Font3D class there is this piece of code

final ServiceLoader<GeometryService> gsLoader =
    ServiceLoader.load(GeometryService.class);

final Iterator<GeometryService> iter = gsLoader.iterator();
if (iter.hasNext()) return iter.next();

throw new IllegalStateException("No GeometryService implementation");

It works fine in Eclipse but when I package my work into a jar file it fails. I have no experience with this area of Java alas, I'd never even heard of ServiceLoader until a few days ago. How can I debug what's going on here. How can I tell where ServiceLoader is looking and why it can't find the class?

0

There are 0 best solutions below