How Do I Automatically Generate A .jar File In An Eclipse Java Project

前端 未结 5 1728
失恋的感觉
失恋的感觉 2020-12-04 16:22

I have an Eclipse Java project. It contains a folder named \"dist\". In that folder is a .jar file.

How can I set things up in this project to make sure th

5条回答
  •  暖寄归人
    2020-12-04 17:16

    Thomas's answer works, but the jar file it produces isn't one that you can use to actually run the application.

    I ended up with:

    
     
    
      
            
            
                
                    
                  
                
                    
                             
            
      
    
    

    Don't know if something has changed in ant since this answer was given, but it took some digging to actually get it working. A lot of the solutions in tutorials were only partial answers...

    Main changes:

    • Added a delete for the jar file as it wasn't regenerating it when I reran the ant build after changing the build file.
    • Added a manifest to set the executable file properly.
    • Pull in some .jar files as libs
    • Pull in the Message_ files for NLS support

    Netbeans makes this so much easier - just check a couple of boxes.

    [Edited to fix issue with incorrectly terminated jar tag and pull in the .jar files]

提交回复
热议问题