| | |
Summary: Creating a JAR package in Eclipse
The instructions for submitting homework require you to package the class files as an executable JAR
file. An executable JAR is a good format also for bringing your solution to class. Here's how you do an
executable JAR in Eclipse:
1. First, create a project for the Hello World and import the source as described in Section 1.
Compiling and running the "Hello, World".
2. From the "File" menu -> "Export ..."
3. "Select": JAR file
4.
5. "JAR Package Specification": Select the files that you will include into the JAR. For our
"Hello, World!" example, this is just the Java source file "Hello.java". You don't need to
include the "hidden" files and folders (e.g., .settings, .classpath, .project).
6. Tick the box to "Export generated class files and resources" and "Export
java source files and resources" (otherwise we will not be able to see your
source files).
7. Select a suitable destination for the output (.JAR) file.
8. You can choose to compress the contents (smaller executable).
9.
10. "JAR Packaging Options": You should make sure to export files with compile warnings. If
there are compiler errors, the program won't run in any case (you can select to export those files
|