I don't understand why this is difficult?
You already know the root you are visiting from the getClassPath(),
so isn't it just a case of removing it.
Of course, some of the roots maybe nested inside the root you are visiting
(nested deployments), but it should be fairly easy to detect this and ignore
them since you will visit that specific root anyway?
i.e. in your example where you have
So the roots in the getClassPath() woud be
When visiting jms.rar you would ignore the jms.rar/jms.jar because that is in the classpath.
When you visit jms.rar/jms.rar you simply remove the root from the path:
Right, I have to go to external information to determine this. What I was suggesting is that when the classpath roots are identified, the corresponding VirtualFile be annotated as such so that one can just walk up the parents of a .class VirtualFile until its root is found.