Netbeans not building the lib folder in the dist folder

17,698

Solution 1

According to this forum.netbeans.org (cached copy as forums.netbeans.org is not accessible atm) article this could be caused by ProjectX.jar being added to the required JARs for some mysterious reason... Could be worth checking

EDIT: cached copy seems to have disappeared, the original thread can be found here.

EDIT again: as both the original and the cached copy have disappeared, head over to the wayback machine to read the article. That being said, anno 2018+ one should probably consider using a more modern / widespread project format like Maven, which is also well supported by Netbeans and offers a much more flexible libraries management approach.

Solution 2

In my case I went to Libraries->Properties. The "lib" folder was added as a library. remove it or remove them (several folders as libraries) and do clean and build.

Hope help you.

Solution 3

The url provided by @fvu die. However I also have that problem and fixed it.

  1. Exit Netbean
  2. Delete your-project-name/nbproject/private
  3. Open Netbean
  4. Clean and build
Share:
17,698
O_O
Author by

O_O

This is my face when I am coding: O_O

Updated on June 08, 2022

Comments

  • O_O
    O_O almost 2 years

    I am trying to clean and build a jar but for some reason when I do a Run-> Clean and Build Main Project, I don't get a lib folder in the dist folder. This is causing a missing classes error when I run my jar file via cmd. How do I configure it to have the lib folder in my dist folder during my build? Thank you.

    Edit: Also, when I hit Run->Clean and Build Main Project, the output says the following:

    2 warnings compile: Created dir: C:\Documents and Settings\me\Desktop\ProjectX\ProjectX\dist C:\Documents and Settings\me\Desktop\ProjectX\ProjectX\dist\ProjectX.jar is a directory or can't be read. Not copying the libraries. Not copying the libraries. Building jar: C:\Documents and Settings\me\Desktop\ProjectX\ProjectX\dist\ProjectX.jar To run this application from the command line without Ant, try: java -jar "C:\Documents and Settings\me\Desktop\ProjectX\ProjectX\dist\ProjectX.jar" jar: BUILD SUCCESSFUL (total time: 3 seconds)

    Why is it not copying the libraries during the build?

  • fvu
    fvu almost 10 years
    @JPVenson but the original is reachable now, so I added its URL back to the article. This by the way is a very good example of why link-only answers have a limited useful lifespan... However, even without the article there should be enough information in my answer to solve the problem (ie, remove the project output jar from the required jars).
  • fvu
    fvu almost 10 years
    @JPVenson I meant to thank you for the heads up, it's always better to have working links in an answer, I apologize for the rather ambiguous tone of my comment.
  • Haha TTpro
    Haha TTpro over 5 years
    I can't go to the link
  • fvu
    fvu over 5 years
    @HahaTTpro see further edit - read both the wayback machine part and my advice on (not) using the NB project format (anymore).