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 92925 - /dist/lib/ is not created -> jar doesn't work
Summary: /dist/lib/ is not created -> jar doesn't work
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Project (show other bugs)
Version: 5.x
Hardware: All All
: P3 blocker with 1 vote (vote)
Assignee: Tomas Zezula
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-01-21 23:26 UTC by _ rkusterer
Modified: 2011-08-31 14:06 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description _ rkusterer 2007-01-21 23:26:16 UTC
My Java SE project depends on libraries from two other (Java SE) projects. I created NB projects for the 
two library projects (one with existing Ant script and one without) and used the library manager and the 
project Properties panel to establish the dependencies between my project and the other two. 

Everything compiles without error message and runs fine in the IDE. The IDE also creates a dist folder 
with a readme.txt that tells me to execute java -jar /dist/xyz.jar -- but the runtime says it is missing 
lots of classes that (according to the manual) should all be in dist/lib/! But neither is this directory 
created, nor was there an error message about why not.

The readme.txt mentions at the very end...

"If the classpath contains a folder of classes or resources, none of the classpath elements are copied to 
the dist folder." 

Aha! But why does it create the JAR file then, if the file cannot possibly work? The readme.txt is more 
confusing than helpful. What about a more explicit hint (in the build output?), "To automatically create a 
distributable file, make sure _all resources_ are JARs" or so? This would have saved me a lot of time. 

PS: By the way, why is it not possible for the build script to wrap all my resources (images, binary data 
files, classes) into JARs automatically?
Comment 1 Milan Kubec 2007-01-22 12:58:46 UTC
Please could you exactly describe the project dependency tree and steps to
reproduce? Because what you describe is supposed to work. I mean having project
A depending on project B and C, where B and C contain sources of libraries
required by A. Then build of project A would copy products of B and C into
dist/lib of A.
Thanks
Comment 2 _ rkusterer 2007-01-22 13:23:01 UTC
Here are detailed instructions that I followed to set up the projects. 
http://www.jmonkeyengine.com/wiki/doku.php?id=setting_up_netbeans_5.0_to_build_jme_and_jme-physics_2

It was me who added the paragraph at the end of this wikipage about /dist/lib/
not getting created. When I create JARs myself as I describe there, /dist/lib/
gets created, but the executable still doesn't work. If you can give me a hint I
will update the wiki page to reflect the best solution. 

Hope that gives you a picture. FYI, my project does contain non-Java binary
resources such as images. I had assumed this was a pretty standard case and it
should work, but this line "If the classpath contains a folder of classes or
resources, none of the classpath elements are copied to the dist folder."
suggests that it doesn't work "out of the box".
Comment 3 _ rkusterer 2007-05-29 18:29:04 UTC
Re: "If the classpath contains a folder of classes or resources, none of the
classpath elements are copied to the dist folder." 

If you rephrase that line, does it mean that "only JARs are copied"? The main
project's resources do end up inside the main JAR created (which is fine). Only
resources in referenced libraries are the problem, they are not copied to
/dist/lib/. 

I looked at my the libraries I use and the non-JAR resources are:
*.dll, *.so, *.jnilib, *.dylib

All other files required are *.jar. And as I said, if I copy them manually to
/dist/lib/, the distributable JAR works fine.

So is it possible to write the standard "dist" ant target in a way that it also
automatically copies these native libraries mentioned above into /dist/lib/?
Comment 4 Karthikeyan Rajeswaran 2007-06-22 18:04:08 UTC
I came across a similar error in NB6.0 and then i noticed that in the compile-time libraries list (ptoject properties |
libraries panel), there was a non-existent library. When i removed the library, the lib directory was created properly.
(If this is not the case with this issue, please update this bug and i will create a separate entry).

The problem seems to be with copyLibs task; when it encounters an error it seems to abort the entire operation.

Regarding the readme file, i agree that it is very unclear. In fact, improving readme's clarity should probably be a
separate P2 bug.
Comment 5 edscholl 2007-06-28 17:34:46 UTC
issue is not mac specific.
Comment 6 Tomas Zezula 2007-06-29 07:42:45 UTC
The problem with a broken reference should be fixed. the copylibs task should work even when there are broken libs when
the project is buildable. 
Comment 7 Karthikeyan Rajeswaran 2007-07-12 19:32:32 UTC
> Regarding the readme file, i agree that it is very unclear. In fact, improving readme's clarity should probably be a
> separate P2 bug.

A P2 issue http://www.netbeans.org/issues/show_bug.cgi?id=108062 has been created for this.
Comment 8 _ gtzabari 2010-05-29 16:13:45 UTC
Three years and counting for such a simple bug...