In order to create a self-executable jar file one must first
write a text file with one line of code and two returns, we shall call this
text file mainClass (the name is not significant, recall when saving a file
using notepad one can preclude notepad adding on an extension by putting the
filename inside double quotes -we do not want an extension on this
filename). Open notepad and type:
Main-Class: CPUMain
followed by two returns. The purpose of this file is to append the default
manifest file created by the jar tool so the java utilities know which file
controls the program. Save this file by typing the following in the file
name box:
"mainClass"
Place this file and all class files, source code files, and
successful test runs (see step 5) that you have completed in a folder labeled with
your name. From the dos prompt inside this folder type the following command
being sure to use your name instead of my name:
jar cmf mainClass tompkinsExec.jar *
Here the asterisk causes all files in this directory to be placed
inside the jar file maintaining any existing directory structure.
That is all there is to it. As our simulator outputs to
System.out there is nothing to see when it runs. So I run the file piping
its output to another file using the following command:
java -jar tompkinsExec.jar>cOut.txt
To extract the contents of this jar file, from the directory
containing the file, type:
jar xf tompkinsExec.jar
Careful here as this command overwrites any existing files with the
same name in this directory.
To create the ten required output files, from the folder
containing the your class files and source code, at the dos prompt type
java CPUMain>c5.txt
and run your simulator on CPUTest5, repeat to create c4.txt, c6.txt,
c6n.txt, c7.txt, c8.txt, c9.txt, c10.txt, c11.txt, and c12.txt.
Step 5 is based on your having downloaded and unzipped the
ManoSimulator, it has all the test files. Be sure to perform step 3 prior to
submitting your executable jar file to make sure it works. At the completion of step
2 your
execute folder labeled with your name should have the following files (the
number of output files may vary if you do not successfully run all ten tests):
Test Data Functionality (MicroOperation
Control Functions):
c4: LDA INC STA HLT (17 clock cycles)
c5: LDA AND STA HLT (18 clock cycles)
c6: LDA ADD STA HLT (18 clock cycles)
c6n: LDA ADD STA SZE HLT negative result (22 clock cycles)
c7: LDA ADD STA HLT BUN (23 clock cycles)
c8: LDA ADD STA BUN HLT BSA (28 clock cycles)
c9: ISZ BUN HLT (40 clock cycles)
c10: LDA CMA HLT (13 clock cycles)
c11: LDA CIL CIR HLT (49 clock cycles)
c12: CLE LDA CIR STA SZE BUN ADD CIL ISZ HLT (246 clock cycles)