Issue
I have java project, and many class that have main method (just for testing purpose). When I create executable jar file by Eclipse, Eclipse will automatically selects which file is main class. (and often wrong).
There is another way is change main class in manifest file in Jar file. But, it's so handy. So, my question is : how to choose this manually when create Jar file.
Thanks :)
Solution
Eclipse will set the class you tell it to set. The wizard has a button for doing this.
Menus:
- Export
- Java, JAR file
- Next (select classes to be included)
- Enter name and path for jar
- Next (not finish)
- Next
- Browse for main class.
Or if you instead create a "Runnable JAR"
- Export
- Java, Runnable JAR File
- Launch configuration -- here select your main class.
Answered By - Hovercraft Full Of Eels
Answer Checked By - Pedro (JavaFixing Volunteer)