NetBeans creates its own JAR file for your project when you run the Clean and Build command from a menu or tool button.
Ideally, the class path of the Jar file should not contain the project root folder, NetBeans adds the JARS library if you automatically added them to the project in the Class-Path property in the manifest.mf file.
If you have any user requirements, you can even modify the manifest.mf file, which is part of the built-in JAR. The manifest.mf file is available in the Files panel in the root directory of the project.
To make a JAR executable with the java -jar command, you must specify the main class in the project configuration. (If the project was created using the NetBeans project wizard, this class is already defined, otherwise we must do it manually)
Specify the main class through the menu option as follows:
File > Project Properties > Run (Category) > Main Class (textbox)
Please provide details of your project, for example
- Is the project created from the Create New NetBeans Project Wizard?
- Is the project based on Ant or Maven?
- Is a free form project project created from an existing source?
This additional information will help me answer the question in specific details. Hope this helps.
considering tushar
source share