How do I get the source location of a wrapped jar?

Apache NetBeans Wiki Index

Note: These pages are being reviewed.

Q: I am looking for a way to get the source location for a wrapped jar that has source specified. The Sources/SourceGroup code does not find sources attached to wrapped jars.

A: The source can be obtained by SourceForBinaryQuery.

  Set<URL> roots = new HashSet<>();
  Set<FileObject> sourceRoots = new HashSet<>();
  for (root : roots) {
    Collections.addAll(sourceRoots, SourceForBinaryQuery.findSourceRoots(root).getRoots());

 — provided by Tomas Zezula