Creating JAR Files with Eclipse

This process is somewhat simpler using the Eclipse IDE. Any reasonable IDE should give you the ability to create a JAR for your application; we use Eclipse here because it is free and pretty reliable and we've been using it a lot in this book.

1.
With an open project, click File > Export….
2.
Select the JAR file and click Next.
3.
Click on the application in the Select the Resources to Export window, because you may not want to include everything. Choose the classes directory (and the source code if you want to distribute it).
4.
In the Select the Export Destination text field, choose where you want your JAR to end up, and give it a name.
5.
Click Next, and Next again.
6.
Click the Use Existing Manifest from Workspace ...

Get Java Garage now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.