Bug 209679 - Can't Resolve Custom Library Jar Added to Classpath
Summary: Can't Resolve Custom Library Jar Added to Classpath
Status: VERIFIED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.5 M2   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-11-13 13:22 EST by Worthy Sizemore CLA
Modified: 2008-09-15 09:15 EDT (History)
2 users (show)

See Also:


Attachments
Example component for library (3.90 KB, text/plain)
2007-11-14 10:03 EST, Worthy Sizemore CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Worthy Sizemore CLA 2007-11-13 13:22:10 EST
Build ID: M20071023-1652

Steps To Reproduce:
1. Create a simple component to be used (like a customized JButton) and wrap it up in a jar as a custom library from within Eclipse.
2. Create a new Java project.
3. Create a new class in that project that will use an instance of the class in the custom library.
4. Create a lib folder within the project.
5. Import the custom jar library into the lib folder.
6. Add the imported jar to the class path.
7. Move the jar to the top of the Order and Export list.
8. Add the appropriate import statement to the top of the created class for the project.

More information:
The bug will appear as the library's name underlined in red so it won't compile.  However, the custom library WILL appear in the Referenced Libraries section.

I've also moved the custom library to the lib\ext folder of Java and, after removing it from that folder, tried adding it as an external jar to the class path.  I've double- and triple- checked to make sure I typed everything correctly, but that's not the problem either.

I currently have a workaround, but I have other projects that will require a common library that will make using the workaround very irritating very quickly.
Comment 1 Jerome Lanneluc CLA 2007-11-13 17:02:11 EST
> The bug will appear as the library's name underlined in red so it won't
compile.
I'm not sure to understand. The import statement is not supposed to reference the library name. Could you please give an example of the .java file you created?
Comment 2 Worthy Sizemore CLA 2007-11-14 10:03:43 EST
Created attachment 82879 [details]
Example component for library

This is the java file of the class that I added as a component for the library that I packed into the jar file.  However, when I tried to reference the library, it wouldn't resolve.  I even attempted to have Eclipse offer a suggestion for an import after I created a new instance of the class when I had the library as part of the Referenced Libraries, but it failed to recognize it.  Yet when I checked the jar in the Referenced Libraries listing, it even showed the compiled class.
Comment 3 Worthy Sizemore CLA 2007-11-15 09:55:19 EST
After much struggling, managed to fix my own problem, but for future reference, the "Add Import" option doesn't work for custom libraries added to the build path.
Comment 4 Frederic Fusier CLA 2007-11-15 10:16:19 EST
Please do not change resolution of a bug, a JDT/Core committer will do it.
FYI: In this case, as nothing was fixed in our code, so the resolution is not correct.
Comment 5 Jerome Lanneluc CLA 2008-08-26 05:19:34 EDT
Resolution should then be WORKSFORME since we were not able to reproduce the problem.
Comment 6 Frederic Fusier CLA 2008-09-15 09:15:54 EDT
Verified for 3.5M2 using I20080914-2000.