I’m writing a Java library in Netbeans 7 which contains a Demo.java main class which gets executed when the project runs. Now I added a Cli.java which is a main class, too. Now I would like to create a JAR file (which is no problem so far). That file should NOT contain the Demo.java but instead use the Cli.java as THE main class.
When I add “Main-Class: packagename.Cli” to the manifest.mf and build the project, the “Main-Class” gets overwritten with “packagename.Demo” although I excluded that class from within the project properties.
So I assume this only works when changing the build.xml (which would even be better as the file is in the version control system). But I haven’t found out how to that. Can somebody guide me to a simple explanation or even provide some lines of XML to accomplish that? Thank you very much.
The following seems to work so far: