This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 130738 - ide can not find the jar files when these jars in project directory
Summary: ide can not find the jar files when these jars in project directory
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Project (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker with 2 votes (vote)
Assignee: Milos Kleint
URL:
Keywords: USABILITY
: 133794 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-03-21 04:35 UTC by hdwang
Modified: 2008-08-25 13:48 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description hdwang 2008-03-21 04:35:49 UTC
Create a java project in NB,and create a folder named "lib"  under the project directory.Put a jar file in the lib 
folder,and add it as a class libary for the project.Then copy the project directory to another computer,and open it in 
the IDE. NB will report a problem of "referenced library can not be found".

Although this problem can be fixed by a wizard, I still think this is problem. here are followings:
(1)if a jar file is stored in a sub folder of the project directory, it should be refered with a  path info relative 
to the project folder;
(2)if a jar file is stored in a folder out of the project directory, it should be refered with a absolute path info. 

 The problem is that  IDE always use a absolute path info,this is not convenient for project management.
Comment 1 Tomas Zezula 2008-03-23 11:38:45 UTC
I've thought it is fixed by shared libraries, I've tried it in current build and it doesn't work, indeed it behaves even worse as before, but it should be easy to fix.
Steps to reproduce:
1) Create project with shared libs
2) Rename project using Rename project action  (also rename project dir)
3) Project is marked as broken, and you cannot fix it since the list of libs is empty.

The reason is that the project.xml/project/configuration/libraries/definition still points to the original (already deleted) project. The ProjectOperations should
fix this reference after move to point to the new location.
Comment 2 Lukas Hasik 2008-04-10 21:36:59 UTC
moving opened issues from TM <= 6.1 to TM=Dev
Comment 3 tboerkel 2008-04-23 18:55:07 UTC
I can't believe this won't be fixed in 6.1 final! This makes NB 6.1 very difficult to use in a shared environment
(multiple developers using same project, project is in Subversion).

This worked very good in NB 6.0! So, this is a regression!

When I open a 6.0 project with RELATIVE paths to JARs in a lib folder, NB 6.0 displays full absolute path in the project
properties dialog.

NB 6.1 RC1 displays half of the JARs with full path and the other half with "lib/JAR-name". Then, when I add a new JAR
from the lib folder, it adds the absolute path to project.properties. In this case, NB 6.0 always added the relative
path to project properties.

So, there are 2 issues, one cosmetic and one fatal.
Comment 4 tboerkel 2008-04-23 21:08:57 UTC
Could someone responsible please raise the priority? Thanks!
Comment 5 adam_myatt 2008-04-24 03:11:14 UTC
I'm also experiencing this problem. Every time I edit JAR references in my projects Libraries the absolute paths are 
set in the project.properties instead of relative paths. This worked fine in NB 6.0. PLEASE raise the priority.
Comment 6 Milos Kleint 2008-04-24 06:25:05 UTC
please consider converting your 6.0 projects to projects with "shared libraries".
Comment 7 tboerkel 2008-04-24 15:23:47 UTC
OK, this seems to work fine. Still, the project is then again incompatible to the previous version.
Comment 8 Lukas Hasik 2008-04-25 08:02:35 UTC
>the project is then again incompatible to the previous version.
NetBeans introduced the shared libraries to solve the problem with libraries sharing
(http://wiki.netbeans.org/OutOfBoxVersionabilityProposal). The solution should be backward compatible with the old
(<6.1) projects.
By incompatible you mean that it define the project libraries as sharable then it doesn't work in 6.0?
Comment 9 tboerkel 2008-04-25 08:13:13 UTC
I was guessing that, because all the project files were different after the change.
Comment 10 Milos Kleint 2008-04-25 08:22:11 UTC
lhasik: the issue is different.
in 6.0 and previous versions nbproject/project.properties *always* contained a relative path to jars, even for
ridiculous paths like ../../../../../Program Files/NetBeans/... Then the private, non shared
nbproject/private/private.properties hold the absolute path to the file, eg C:/Program Files/Netbeans/...
in 6.1 we no longer bother maintaining the private.properties files with absolute paths. The idea was that if you don't
care, you use the non-shared projects and therefore get the absolute paths everywhere straightaway. if you care, you use
the shared libraries that manage the paths.
if you use the shared libraries, you get different build script, changes in the project.xml and in both shared and
non-shared cases the property values are written differently. That can indeed be considered incompatible change. However
unlike in javacode APIs, it's rather tough to do any changes to the build process in a "compatible way"
Comment 11 pmccabe 2008-04-25 16:49:55 UTC
*** Issue 133794 has been marked as a duplicate of this issue. ***
Comment 12 Milos Kleint 2008-08-25 13:48:56 UTC
I think we've addressed this in another issue for 6.1 patches. Even if the project is not a "project with sharable
libraries folder" we allow the user to pick how the jar file added to project shall be referenced. The choice is
"absolute path", "relative path" and since 6.5 also "path from variable". For projects with sharable libraries folder we
also offer to copy the jar to the libraries folder to keep external dependencies in one place.

I consider the issue fixed.