开发者

NetBeans & Executable JARs

开发者 https://www.devze.com 2023-04-02 00:01 出处:网络
New to NetBeans dev here. When I first created my project and began compiling, I noticed that NetBeans had automatically created a dist/ directory under my project root and was creating an Executable

New to NetBeans dev here. When I first created my project and began compiling, I noticed that NetBeans had automatically created a dist/ directory under my project root and was creating an Executable JAR in that directory.

I've now been developing for several weeks, and added many resource files to my project, including a system log file, an embedded SQLite database, and several properties files. These are files that my program (a Swing app) needs to read/write from at runtime in order to function correctly.

I just noticed this morning that the Executable JAR in my dist/ directory is several weeks old, and that compiling my project doesn't update it. I am wondering if that's because there are now all these new resource files and NetBeans doesn't know how/where to package them for the automatically-created Executable JAR.

Does this mean that I'll have to tweak the build.xml myself? Or is there a NetBeans dialog I can get to where I can specify where to pacakge everything? And if NetBeans should be doing this automatically, what could be the reason that it stopped creating the JAR for me, and what can I do to force this functionality again?

I went into Project 开发者_如何学PythonProperties >> Packaging and made sure that the JAR file directory was still dist/MyProgram.jar and that the checkbox Build JAR after compiling was still checked, so obviously something else is either breaking the build or messing with NB.

Thanks for any tips!


If "Compile on Save" is enabled, then your .jar file will only be generated when you do a "Clean & Build" (Just "Build" is not available when "Compile on Save" is enabled)


You need to Clean and Build within netbeans to update the file within your /dist directory.

I use Netbeans 7.0 and this solution works for me.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号