简体   繁体   中英

Netbeans not building the lib folder in the dist folder

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?

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.

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.

In my case, I solved the same problem as follows : 1) Go to Project > Libraries > Properties > Libraries > Compile 2) Select missing libraries beginning 'Missing library :' and remove them 3) Clean and build

Cheers.

The problem is that you add the folder where are you libraries, you need to actually add the libraries and not the folder where they are.

1) Go to Project > Libraries > Properties > Libraries > Compile

delete the folder you add in these case C:\\Documents and Settings\\me\\Desktop\\ProjectX\\ProjectX\\dist

Select add JAR/Folder and these time open the folder and add all the libraries inside, Netbeans will allow you to select it all.

Now you suppose to be good.

There is a setting in Net Beans. Right click on Net Beans project you have created.

Click on Build->Packaging. You will get 03 options on the right pane

  • Compress JAR File
  • Build JAR after Compiling
  • Copy Dependent Libraries

Select the 03rd one and then build. You can see the /lib folder under /dist

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM