Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Netbeans not building the lib folder in the dist folder

Tags:

java

netbeans

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?

like image 444
O_O Avatar asked Aug 31 '11 22:08

O_O


2 Answers

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.

like image 189
fvu Avatar answered Oct 17 '22 14:10

fvu


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.

like image 45
Zamir Peña Avatar answered Oct 17 '22 15:10

Zamir Peña