Imagine I have a file that contains the following import statement:
import a.b.c.D;
We can assume this class (a.b.c.D
) has already been compiled. How can I find (programmatically) the location of the .class
file on the disk, starting from the "a.b.c.D" string?
Consider that:
c
ina.b.c.D
might be a class, despite this being highly unorthodox.D
might be defined in fileE.java
(Java allows the definition of multiple class per file, as long as only one is public)- the
.class
file might be in a.jar
or.zip
file
Ideally, I don't want to write an algorithm to traverse directories and .jar
as that seems to involve quite a bit of work.