Bug 59282 - Unable to include an external folder with class files to project classpath
Summary: Unable to include an external folder with class files to project classpath
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.0 M9   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 59987 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-04-20 11:53 EDT by Ondrej Chylik CLA
Modified: 2004-05-18 18:20 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ondrej Chylik CLA 2004-04-20 11:53:06 EDT
Documentation to IClasspathEntry ( 
http://help.eclipse.org/help21/topic/org.eclipse.jdt.doc.isv/reference/api/org/e
clipse/jdt/core/IClasspathEntry.html ) mentions possibility to use a folder 
with class files external to the workspace.

But this does not work. The Build Path configuration dialog allows only picking 
folders from workspace, but I have tried adding entry

<classpathentry kind="lib" path="/C:/test/classes"/>

directly to .classpath file in my project. The build path was considered OK, 
but the classes from the folder were not available on the project classpath.
The interesting thing is, that when I specified a non-existing folder, I got a 
build path error and the project did not compile at all.

Same behavior observed in both E2.1 and E3.0M8.

Note: "Setting the Java build path" ( 
http://help.eclipse.org/help21/topic/org.eclipse.jdt.doc.isv/guide/jdt_api_class
path.htm ) mentions that the class file folder should be inside the workspace 
only, which is a conflict with the documentation mentioned above.
Comment 1 Olivier Thomann CLA 2004-04-20 12:46:01 EDT
You should not edit the .classpath yourself.
Go to the project properties>Java Build Path>Libraries>Add Class Folder>Create
New Folder...>Advanced>

In the folder name, you put the name you want to see in the project. You check
"Link to folder on the file system" and then you browse to the directory you want.

Click OK until you close the dialog. This should work.
Comment 2 Ondrej Chylik CLA 2004-04-20 13:00:37 EDT
I see, so I must link the external folder into the workspace.

However that means that the documentation in IClasspathEntry is not right. I 
found this problem because I actually did this thing programatically (which now 
turns out to require two steps - linking the folder and then adding it to the 
classpath).

And second point is that the build path processor in fact considers the 
external folders somehow - as I wrote, it was checking whether the folder 
exists or not and did not produce any warning about that it is not supported 
(or that it is not a jar file).

And sorry for touching the .classpath file directly, that was just for 
testing :-)

Comment 3 Philipe Mulet CLA 2004-04-26 07:21:57 EDT
Jerome - pls make change to spec to clarify this situation.
Comment 4 Jerome Lanneluc CLA 2004-05-17 11:04:49 EDT
Clarified the spec to say that a binary folder must be internal to the 
workspace, or that it must be first linked using IFolder#createLink(...) if it 
is external.
Comment 5 Jerome Lanneluc CLA 2004-05-18 12:22:45 EDT
*** Bug 59987 has been marked as a duplicate of this bug. ***
Comment 6 Olivier Thomann CLA 2004-05-18 18:20:40 EDT
Verified in 200405180816.
Clarifications have been added inside javaCore.newLibraryFolder(...).