Hmm after long time with out blogging. Finally decided to add some posts to my blog. So in this post I would like to describe how to build a fat jar using NetBeans. Of course you can simply do it using Eclipse. But in Netbeans you can't actually directly build a fat jar. The jar which is build using NetBeans is not adding the libraries you've used for the project. The libraries are added to a folder called "lib" whenever you run the jar the "lib" folder must be in the same directory.
So lets get started building a fat jar using Netbeans. The first thing you have to do is clean and build the project.
Then go the Files view of the Project and open the build.xml file.
Then copy and paste the following code just before the " project" tag ends.
Download file from here DOWNLOAD FILE
Then it's almost done. Now in files view of the project right click build.xml file and then select Runtarget >> Other Targets >> package-for-store.
That's it now your fat jar has been created. Go to your project folder and check the folder called store. Inside that folder you can see your fat jar.
That's it now you know how to build a fat jar using NetBeans. If you need any help just put a comment. Cheers :)
Good one. Works fine for me.
ReplyDeleteThis one solved a problem of mine, mate :) Keep up the good work
ReplyDeleteThanks all... :)
ReplyDeleteThanks a lot!
ReplyDeleteWhen stealing an article, at least link the original.
ReplyDeletehttp://www.oracle.com/technetwork/articles/javase/single-jar-141905.html
@Unknown I didn't steal it. I got the script from one of my seniors.. Anyway thanks for reference.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteGreat Help !! Thanks a lot :)
ReplyDeleteThanks a lot.
ReplyDeletevery thanks, therefore I can access this article by way of google . Oracle web site does'nt apper in searching
ReplyDeleteI get this great post via stackoverflow, thanks a lot!
ReplyDeleteThanks this works like charm
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteshows "unable to find application class name" for javafx desktop application.............plz help
ReplyDeleteGreat Post. Followed the steps and it worked like a charm. Thanks.
ReplyDeleteThanks a lot! Worked perfectly
ReplyDeleteHiii...
ReplyDeleteI am using NetBeans IDE 7.4. In which I am facing same problem.
When I am trying same solution which is provided by author, I am not getting that option "Package-for-Store".
Please HELP ME..!!!!
Thanks in advance
hii..Aruna Karunarathna. i got a an error while ruuning the "one jar",error Could not found or load main class$(main.clss).i changed class name also stil its showing same error ,can you please tel me whtas wrong with me.,,Thank you
ReplyDeleteShows "unable to find application class name" for javafx desktop application for me to. Could you help us?
ReplyDelete@Krisz Seems like a netbeans bug, https://netbeans.org/bugzilla/show_bug.cgi?id=203287
ReplyDeleteCheck updating the netbeans IDE.
Useful and reliable. Nice.
ReplyDeleteThanks !
Hello,
ReplyDeletewhile including lib into jar file some of the jar of the lib folder not included into the packaging of jar file. please help why this is happening and what the solution.
Very very very good!!!
ReplyDeletethank machan
ReplyDeletePlease, how do I indicate the first class to run in the build.xml file, given that my application has a main method for each class.
ReplyDeletePlease, how do I indicate the first class to run in the build.xml file, given that my application has a main method for each class.
ReplyDeleteThanks, Useful and reliable!
ReplyDeleteI have done just fine the very first time I did, doing a Standalone Application Project. I have moved it to new Enterprise Application Client. Every dependencies resolved and Build successfully. But after modifying the bulild.xml correctly with the snippet needed and the value of the property changed to the Project name, it gives an error when "Package for Store":
ReplyDeleteant -f ... package-for-store
Target "jar" does not exist in the project "..." . It is used from target "package-for-store".
BUILD FAILED (total time: 0 seconds)
thank you very much!
ReplyDeleteWell done, its really helped me. There is also a reference here
ReplyDeletehttps://www.oracle.com/technetwork/java/javamail/single-jar-141905.html
This reature not exists in 2019
ReplyDeleteHave done all steps but jar fat file is not executing.Do you have any idea for the solution of this problem.Even simple jar file run.
ReplyDeletePerfectly, Thanks a lot
ReplyDeleteThanks alot.but how do i include a pdf file as well?
ReplyDeletewhy is not working for me ? is there anything that i should check, please pm me in lusi.rhozalina@gmail.com
ReplyDeleteYou shouldn't put private information. What's the error you are getting?
DeleteIt works, it happen because i used demo library for graphic. After i change the library. It works
DeleteThanks for your attention
Thanks a lot Bro. Weda kara mata nam
ReplyDelete