Producing executable jar in NetBeans

前端 未结 17 1510
感动是毒
感动是毒 2020-11-30 08:55

I\'m using NetBeans 6.5 and for some reason it won\'t produce executable jar \"out of the box\".

I set my project to be the main project, defined main class in the p

相关标签:
17条回答
  • 2020-11-30 09:17

    A better solution:

    Edit nbproject/project.properties and add the entry:

    manifest.file=manifest.mf
    

    manifest.mf should be in project's root and contain just:

    Manifest-Version: 1.0
    X-COMMENT: Main-Class will be added automatically by build
    

    Works. Tested.

    0 讨论(0)
  • 2020-11-30 09:23

    Another approach entirely is to develop, run unit tests, etc. in NetBeans but then use a maven or ant script to do your "real" build. It seems like these kinds of build tools give you more control over how things are built, and it also lets you automate builds.

    For maven, you can add entries to the manifest easily using the maven jar plugin:

    http://maven.apache.org/plugins/maven-jar-plugin/

    0 讨论(0)
  • 2020-11-30 09:25

    Interesting information might be here:

    http://wiki.netbeans.org/FaqNoMainClass

    0 讨论(0)
  • 2020-11-30 09:26

    I actually came across this page after running into the same issue, I edited the manifest.mf file but the changes weren't showing up in the jar MANIFEST.MF file. I found the issue that I was having and thought I would pass along the information just in case it's relevant.

    What I was doing wrong was I didn't have the project I was working on set as the main project, so while I was editing the the correct manifest, I was compiling the wrong project.

    So I suppose the short of the story did you check and see if you have the correct project selected for the manifest.mf file you are editing?

    0 讨论(0)
  • 2020-11-30 09:27

    Very simple, The .jar and .jad files are there in dist folder

    I was also searching for answer and got this one from http://forums.netbeans.org/ptopic3465.html

    Solved :)

    0 讨论(0)
  • 2020-11-30 09:28

    Did you clean the project and rebuild? It sound like you're doing it right. Heres some references just in case:

    http://www.velocityreviews.com/forums/t141385-how-to-create-executable-jar-in-netbeans-ide.html http://dr.berkeley.edu/REM/wiki/index.php/Making_a_Java_executable_jar_in_Netbeans

    0 讨论(0)
提交回复
热议问题