簡體   English   中英

在NetBeans中導出Jar文件

[英]Export Jar File in NetBeans

我正在尋找一種在Netbeans中導出.jar文件的方法。 我知道,當我清理/構建它時,會將所有內容自動放入dist目錄的.war文件中。 但是,在Eclipse中,可以選擇“導出”->“導出”->“ Java”->“ JAR文件”,然后單擊“下一步”,僅選擇要導出的資源,然后選擇要將.jar文件導出到的位置。 Netbeans中有與此等效的東西嗎?

您可以在Netbeans中啟用“編譯后構建JAR”屬性

文件>項目屬性>構建>打包

我最終只是以通常的方式構建項目,從而在dist文件夾中獲取.war文件。
然后,我使用了一個名為IZArc的zip程序: http ://www.izarc.org/來打開.war並僅獲取構建.jar所需的內容。 然后,我再次使用IZArc創建.jar文件。
如果有人知道更簡單的方法(最好通過Netbeans本身),請告訴我。

如果您知道如何編寫Ant文件,請編輯build.xml並添加-post-dist目標。 然后,在創建war文件時也將創建jar文件。 就像是:

<target name="-post-dist" description="Create jar file.">
    <!-- Copy your files to a temp directory if necessary. -->
    <copy ...>
       ...
    </copy>

    <!-- 'basedir' should be the directory from which to jar the files -->
    <jar destfile="${dist.dir}/app.jar" basedir="${build.dir}/myjarfiles"/>
</target>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM