Adam Bien's Weblog
How To Fix The libs.CopyLibs.classpath Problem in Netbeans 6.5
Recently I encountered the following error running a Java EE project from different Netbeans installation:
Z:\work\workspaces\winery\winery\nbproject\build-impl.xml:137: The following error occurred while executing this line:
Z:\work\workspaces\winery\winery\winery-war\nbproject\build-impl.xml:347: The libs.CopyLibs.classpath property is not set up.
This property must point to
org-netbeans-modules-java-j2seproject-copylibstask.jar file which is part
of NetBeans IDE installation and is usually located at
<netbeans_installation>/java<version>/ant/extra folder.
Either open the project in the IDE and make sure CopyLibs library
exists or setup the property manually. For example like this:
ant -Dlibs.CopyLibs.classpath=a/path/to/org-netbeans-modules-java-j2seproject-copylibstask.jar
I found only few pointers to the problem in the web. You will find a hint in the last line of the error report - you have to add the property libs.CopyLibs.classpath to the ant build.
It can be accomplished in menu: Tools --> Options --> Miscallenous --> Ant. Put the property libs.CopyLibs.classpath=[Netbeans Install]\NetBeans6.5\java2\ant\extra\org-netbeans-modules-java-j2seproject-copylibstask.jar (without -D). It should work after that.
I encounter the phenomenon few times. It seems like the error happens after upgrading the libraries (in my case icefaces 1.7.2 to 1.8.0), or running the ant build outside Netbeans in command shell, or continuus integration like hudson.
Posted at 09:00AM Apr 27, 2009 by Adam Bien in Java EE 5 Architectures And Idioms | Kommentare[11]
[my tweets]
Rss My book: Real World Java EE - Rethinking Best Practices


thats strange, netbeans adds the copylibs ant task usually to the libraries which enables building with ant outside NB. Never had any issues with this.
Gesendet von mbien am April 27, 2009 at 10:17 AM CEST #
Had issues few times:
1. Trying to run a checked-out Java EE Ant projects in Hudson.
2. Trying to build a project from a NB with different icefaces libraries
3. A team member tried to open a checked-in project (no idea why this happened)
There are only few pointers in the foras (or forums plural), without real answers. This hack seems to work. I posted it - now its persisted :-)
regards,
adam
Gesendet von Adam Bien am April 27, 2009 at 11:24 AM CEST #
Is your project using sharable libraries folder or not?
If it does not then check if libs.CopyLibs.classpath is defined in file {NetBeans-userdir}/build.properties. This file is autogenerated/updated after any change in IDE's Library Manager. I can imagine that a build from command line (after fresh checkout of the project from a VCS) will fail because project is not connected to IDE's userdir yet - that happens when you open it in the IDE and reference to above mentioned file is stored in private.properties as value of user.properties.file property.
If your project is using sharable libraries then situation is different and you should have a look at {project's-sharable-libraries-folder}/nblibraries.properties file which should contain the property. That property was added during project creation and because it is sort of internal jar required for building projects the property is rechecked during each project opening and recreated if necessary.
Gesendet von David Konecny am April 27, 2009 at 11:04 PM CEST #
@David,
in one case it was "just" a default Java EE project with IceFaces. Your response is the first good explanation of the problem :-)
Thanks!,
regards,
adam
Gesendet von Adam Bien am April 28, 2009 at 10:13 AM CEST #
If you want a truly interoperable project, i. e. one that can be checked out and built from the command-line or used by Eclipse guys, then you need to distribute the copylibs.jar with your project.
I put something like this in my build.xml:
<property name="libs.CopyLibs.classpath" value="bin/copylibstask.jar"/>
You won't then automatically get the newest version when you upgrade Netbeans, but you are not dependent on a local path anymore that might only exist on your machine.
Gesendet von 81.91.160.182 am April 29, 2009 at 05:40 PM CEST #
Superb answer thanks. I was worried since the day i started using 6.5 of netbeans.
Gesendet von Lava Kafle am June 16, 2009 at 10:02 AM CEST #
Hey,
thanks for this info, it happend to me while running check of updates in netbeans 6.7.
Gesendet von zeldi am August 13, 2009 at 11:52 AM CEST #
Thanks for the information.I was hitting my head over this problem and your resolution made my code run like a Rocket.
Cheers
Rajat Bhatnagar
Gesendet von Rajat Bhatnagar am September 19, 2009 at 07:41 AM CEST #
Fantastic.
I updated the build.xml file
<target name="-init-taskdefs">
<property name="libs.CopyLibs.classpath" value="bin/copylibstask.jar"/>
<fail unless="libs.CopyLibs.classpath">
..........
And it worked.
Gesendet von Saurabh Gupta am October 16, 2009 at 09:31 PM CEST #
hi, great post! i had the same problem after installing portal-pack netbeans plugins, but something is missing: i added the line libs.CopyLibs.classpath=Applications/NetBeans/NetBeans\ 6.7.1.app/Contents/Resources/NetBeans/java2/ant/extra/org-netbeans-modules-java-j2seproject-copylibstask.jar
but i still have some reference problems, as asked at http://forums.netbeans.org/viewtopic.php?p=58354#58354 . Someone has a clue of what is going on? Thanks
Gesendet von mox601 am December 22, 2009 at 12:52 PM CET #
Thank you very much, this fixed my problem.
Today I accidentally started Netbeans 6.7 twice - which may or may not be related to the cause of the problem.
This was the solution.
Gesendet von Martin Jenkins am February 02, 2010 at 11:39 AM CET #