Saber Mhadhbi Saber Mhadhbi - 7 months ago 12
Java Question

How to create jar from many java class using netbeans?

I have a java package with many java class and many main. i wish to make jar from these package ? can you help me please ?
(i work with netbeans )

Answer

If the project is under netbeans IDE, you should follow these steps:

  • Right click on the project and then click on Properties

  • Click on Packaging

  • Click on Compress JAR File

  • Accept changes, click OK

  • Right click on the project and then click on Clean and Build

  • Go to the directory where your project is stored

  • Look in the dist folder for the JAR file

    To select the main class that will be executed

  • Click on Run

  • Click on Browse near to Main Class label

    enter image description here

    EDIT :

    If you are using netbeans under windows, and if the jar file does not generate any output, try the following command in cmd :

    start /b <jar file>
    

    Then an error should appear

    So you can know what is the problem

  • Comments