Bug 393456 - user library missing
Summary: user library missing
Status: RESOLVED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.7.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: needinfo
Depends on:
Blocks:
 
Reported: 2012-11-02 15:16 EDT by Rajah Chacko CLA
Modified: 2013-01-08 13:09 EST (History)
2 users (show)

See Also:


Attachments
Adding the jar to the user library (67.12 KB, image/png)
2012-11-02 15:16 EDT, Rajah Chacko CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Rajah Chacko CLA 2012-11-02 15:16:45 EDT
Created attachment 223132 [details]
Adding the jar to the user library

I added a user library and added a jar to that library. When I come back to the User Libraries screen, I get a "missing" and red X next to the added jar. 

In the past, I have successfully added dozens of jars to a user library without incident. 

This is not an intermittent problem; it happens every time I add a jar to a user library. I have looked at the jars in 7zip and the jar looks reasonable. 

I have tried this both from the Window -> Preferences -> Java -> build path -> User libraries route and another route (by clicking on a project -> build path -> Configure build path).

I have tried changing the JDK based on http://stackoverflow.com/questions/4717932/add-jars-to-user-libraries-in-eclipse-helios-mac-osx. Went from JDK 1.6.0_25 to 1.7.0 and back again.

I have also tried re-starting Eclipse with a -clean argument.
Comment 1 Markus Keller CLA 2012-11-05 08:39:21 EST
This works for me. Please try with 3.8.1 or later. If you can reproduce, then post the full OS path to the JAR you're trying to add. Maybe the problem is a special character in that path.
Comment 2 Rajah Chacko CLA 2012-11-05 14:21:50 EST
I have found out more what causes the problem and have found a workaround.

The problem is caused when I choose Preferences -> Java -> Build Path -> User Libraries | Add JARS... and add a new jar file. What happens is that although the user library is given an absolute path (C:\Documents and Settings\a23456\box_corefx\1box-corefx\box-build\target\deployment\weblogic\APP-INF\lib\antlr-2.7.6.jar) it only stores a relative path (\1box-corefx\box-build\target\deployment\weblogic\APP-INF\lib\antlr-2.7.6.jar). This relative path is what makes it say "missing." 

The workaround is to export a good user library and massage a directory of the jars so that it has entries like: 
<archive path="C:/Documents and Settings/a23456/box_corefx/1box-corefx/box-build/target/deployment/weblogic/APP-INF/lib/antlr-2.7.6.jar"/>

Then import the new user library.
Comment 3 Markus Keller CLA 2012-12-14 11:27:24 EST
Is your workspace at "C:/Documents and Settings/a23456/box_corefx" and
"1box-corefx" is a project in your workspace?

If yes, then the relative path is expected. For JARs from the workspace, we only save a relative path, so that the reference doesn't break when the workspace is renamed or moved.

I still can't reproduce any problem. The relative path is correctly resolved for me.
Comment 4 Markus Keller CLA 2013-01-08 13:09:30 EST
Closing. Please reopen if you have more information.