Reputation: 3204
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?
Upvotes: 5
Views: 10675
Reputation: 1697
Try to do this, works for me on eclipse Indigo.
<classpathentry kind="lib" path="/A" excluding="B/"/>
Upvotes: 2
Reputation: 89749
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.
Upvotes: 9