Adam Bien's Weblog

Monday Apr 27, 2009

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.


NEW: Java EE 7 Testing and Quality Workshop

A book about rethinking Java EE Patterns

Comments:

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.

Posted by mbien on April 27, 2009 at 12:17 PM 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

Posted by Adam Bien on April 27, 2009 at 01:24 PM 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.

Posted by David Konecny on April 28, 2009 at 01:04 AM 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

Posted by Adam Bien on April 28, 2009 at 12:13 PM 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.

Posted by 81.91.160.182 on April 29, 2009 at 07:40 PM CEST #

Superb answer thanks. I was worried since the day i started using 6.5 of netbeans.

Posted by Lava Kafle on June 16, 2009 at 12:02 PM CEST #

Hey,

thanks for this info, it happend to me while running check of updates in netbeans 6.7.

Posted by zeldi on August 13, 2009 at 01:52 PM 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

Posted by Rajat Bhatnagar on September 19, 2009 at 09: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.

Posted by Saurabh Gupta on October 16, 2009 at 11: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

Posted by mox601 on December 22, 2009 at 01: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.

Posted by Martin Jenkins on February 02, 2010 at 12:39 PM CET #

Thanks, your tip worked

Posted by 184.71.0.174 on January 12, 2011 at 05:55 AM CET #

Thanks a lot for this hint.
I was scratching my head looking for an answer.

cheers,

Posted by Joao Araujo on June 04, 2011 at 06:35 AM CEST #

I fixed the libs.CopyLibs.classpath but i get the following erro:

Refeitorio-ejb.compile:
Refeitorio-ejb.library-inclusion-in-manifest:
C:\refeitorio\Refeitorio\nbproject\build-impl.xml:160: The following error occurred while executing this line:
C:\refeitorio\Refeitorio\Refeitorio-ejb\nbproject\build-impl.xml:456: Problem: failed to create task or type copyfiles
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.

How do I fix that?

Posted by Reudismam on June 21, 2011 at 04:48 PM CEST #

yes after restarting Netbeans IDE the problem is resolved :)

Posted by Chanchal on August 07, 2011 at 09:46 AM CEST #

This is the full string I had to use with NetBeans 7.0.1 in Mac OS X 10.6 Snow Leopard

libs.CopyLibs.classpath=/Applications/NetBeans/NetBeans 7.0.1.app/Contents/Resources/NetBeans/java/ant/extra/org-netbeans-modules-java-j2seproject-copylibstask.jar

Posted by Steve on August 31, 2011 at 09:44 PM CEST #

Thanks.it worked.

Posted by Amrita deb on September 22, 2011 at 11:44 AM CEST #

For me worked copy the properties of nbproject/private/private.properties into the project.properties.

Or you can also follow this tutorial:
http://weblogs.java.net/blog/fabriziogiudici/archive/2006/11/setting_up_netb.html

The thing is that the build-impl generated have references to those properties.

Posted by jlich on January 19, 2012 at 08:08 PM CET #

it worked adding
<property name="libs.CopyLibs.classpath" value="bin/copylibstask.jar"/>
in build-impl.xml

Posted by bs on January 27, 2012 at 05:59 PM CET #

it worked GREAT !!! thnx

Posted by ivan on March 20, 2012 at 01:08 AM CET #

This happened to me today when I copied my NetBeans project (it's a customized Java EE project type) to a different box and tried to build the project on the new box.

I figured out what was the cause of this issue and I would like to share here.

1. The correct application server was not added into NetBeans on the new box;

2. A couple of properties (j2ee.server.instance and deploy.ant.properties.file) in nbproject/private/private.properties were not correct. They were still pointing to the configuration on my old box.

Once both issues were fixed, I can clean and build my project just fine.

Posted by jqian on May 18, 2012 at 07:00 AM CEST #

Thank you so much for the posting, this issue had almost driven me demented the last few days, while trying to get Hudson to build my NB projects.

And you solution work like a gem :-)

cheers and thanks

Posted by Patrick Mac Cnaimhin on May 24, 2012 at 04:05 PM CEST #

thanks! i solve the problem finally, but the classpath should be with quotation marks

Posted by jerry on August 14, 2012 at 07:58 AM CEST #

am using netbeans ide7.2 my all jsp files were running successfully. But suddenly, Its showing an error.
please help me out.

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

Posted by Imran Ahmad on November 16, 2012 at 10:25 PM CET #

Looks like your project is using Ant, but you don't have the Ant plugin installed. To install the plugin, go to Tools -> Plugins

Then click the :Available Plugins" tab, click the "Name" header to sort in alphabetical order. Click the check box next to Ant and then click install.

If you don't see "Ant" in the list, you could try clicking "Reload Catalog" in the "Updates" tab.

Posted by totta on May 05, 2013 at 09:31 PM CEST #

Thanks a lot!!!!!!!!!!!:))))))))

Posted by shilpa on May 14, 2013 at 12:33 AM CEST #

Post a Comment:
  • HTML Syntax: NOT allowed
realworldpatterns.com
...the last 150 posts
...the last 10 comments
Links
License