I’m am creating a VoIP client server pair in java using the netbeans IDE. I would like to use only 1 project but I am unfamiliar with with how netbeans would create the Jar file. I need a to if this is possible and if so, how to set it up.
Share
I believe the purpose of a ‘main class’ means that the eventual JAR’ manifest file, will label one class as being the ‘class to run’: so that the end-user can just double-click it* or run a simplified commandline like:
java -jar <jar>rather than having to specify the whole package/class name like:
If I’m right, then I don’t see how it would make sense to have more than one main class ?
Maybe I misunderstod your question – or there is another purpose to the ‘main’ class?
If you mean having two classes which have a ‘main’ method – then this is fine – the end user can launch any of the classes by name – and so long as they have the standard main method sig, for instance:
it should just work.
*(on Windows at least, and whether that works also depends on which JRE they have and probably other things)