Creating a Jar File
Once you have successfully completed your programming assignment, you
will
need to create a Jar file to submit your assignment. This
will help us grade your assignment. You will lose points if you do
not
submit your programming assignments in a Jar file.
Instructions for checking your Jar file
What's a Jar File?
Jar stands for "Java Archive". It's much like a compressed ZIP file
that
you may have used before. You'll be adding each Java source file in
your
assignment (usually only one file) to a Jar file before submitting.
The size of the final Jar file will be smaller than the original programs
and therefore be easier to e-mail.
How Do I Create a Jar File?
-
After you've successfully compiled, run, tested, and commented your
program,
choose New...Standard Project from the Project menu
in jGRASP.
-
You will be offered the opportunity to add java files to the project.
Add the appropriate one (or ones). Then complete. You should see the
project
open in jGrasp, as below.
- After you've successfully compiled, run, tested, and commented
your program,
choose Create Jar File For Project... from the Project
menu
in jGRASP.

-
The Create Jar File for Project (default) window should open.
Select the checkbox marked 'sources.' The top box may already include
your java file. Click Add to choose your Java source
files for the current assignment if they are not included already.

-
A file dialog box will open. Choose each file you want to add to the
Jar
file and click Add. You should add only the Java source files
(ending
in .java). Once you have added the files, click Cancel in the
file
dialog box.
-
After the file dialog box closes, you should be back to the Create
Jar
File for Project (default) window. The files that you have added
should
be displayed in the "Additional (non-project) Files" list. After you
have
double-checked that you have added the appropriate files, click
Next
to continue creating the Jar file.

-
A new window will open asking for the name of the Jar file to create.
You
should name the file lastname_assign#.jar.. Make
sure
that the Jar file ends in .jar and that the file is being created in
the
same folder as your Java source files. Once you have appropriately
named
your Jar file, click Create Jar.

-
After the Jar File has been created, click the R button in the
Browse
window to the left. This will refresh the list of files in your current
folder. Your newly-created Jar file should appear in the list.

-
If you have problems creating a Jar file, contact me.
How Do I Check to Make Sure My Jar File is
Correct?
-
After you've completed the steps above, your
Jar file
should appear in the list of files on the left side of your jGRASP
window.
-
Choose Jar/Zip Extractor... from the Project
menu.
-
In the Jar/Zip Extractor window, click
on the
folder icon.

-
In the Open File window, chose the Jar
file
that you just created and click Open.

-
If you see the name of your Java source file in
the
Jar/Zip
Extractor window, you have successfully created your Jar file. (You
may also see some other files, like "META-INF" and "MANIFEST.MF" in the
window.) Double-check the "Modified" date to make sure that you've put
the latest version of your Java source file in the Jar file.

-
When you submit your assignment, you
only need to attach the Jar file.