I'm trying to add two folders to my eclipse project's classpath, let's say Folder A and Folder B. B is inside A. Whenever I add A to the classpath
<classpathentry kind="lib" path="/A"/>
it works just fine, but I need to be able to access the files in B as well. Whenever I try to add
<classpathentry kind="lib" path="/A/B"/>
to the classpath, it says
Cannot nest 'A/B inside library A'
I'm a newbie when it comes to editing the classpath, so I'm wondering, is there is anyway to add a folder in the eclipse classpath that is nested in another folder that is also in the eclipse classpath?
The . classpath maintains the project's source and target references for Java compilation and compressed file or project dependencies. This configuration is maintained through the Java Build Path page in the project's properties.
I don't think you can (or should be) allowed to do that, and it's not really an Eclipse issue AFAIK
Any individual classpath is a root under which the JVM starts looking for classes using the standard package notation
So let's say that your program has a class X in the default package, and a b.X class in the b package. If the default package root is /a, then your package b would be in /a/b
If you had one classpath root pointing to /a and one classpath root pointing to /a/b, and now you asked for class X, then one could interpret your request as X in the default package (since there is a root at A), but also as class X in the default package relative to the path /a/b, but that is the class b.X
So to prevent these things from happening, you're not allowed to have classpath roots that are nested.
Try to do this, works for me on eclipse Indigo.
<classpathentry kind="lib" path="/A" excluding="B/"/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With