á Make sure Java is installed on your computer.
á Figure out how to open the terminal window. If you type in which javac it should show you the path to the Java compiler.
á Decide where you will keep your work and define two folders/directories, one for the project workspace and one for the libraries you will use. We will name them CommandLineWorkspace and CommandLineJars.
á Copy into the CommandLineJars the tester.jar library file (and the drawing library files, if you plane to use them).
á In the CommandLineWorkspace make a directory Project1, then move to that directory.
á Copy the Shapes.java file into the Project1 directory.
á To compile your program type into command line
>> javac -classpath
.:../../CommandLineJars/tester.jar
Shapes.java
á To run your program type into command line
>> java-classpath .:../../CommandLineJars/tester.jar tester.Main
á The results will be shown as follows:
---------------------------------
Tests for
the class: Examples
Tester
Prima v.1.3.4 - 16 November 2009
----------------------------------
Ran 16
tests.
3 tests
failed.
Issued 5
warnings of inexact comparison.
Failed
test results:
--------------
Error in
test number 1
tester.ErrorReport: Error
trace:
at Examples.testDistTo0(Shapes.java:200)
actual:
expected:
0.0.....................................0
Error in
test number 2
tester.ErrorReport: Error
trace:
at Examples.testDistTo(Shapes.java:208)
actual:
expected:
5.0.....................................5
Error in
test number 4
tester.ErrorReport: Error
trace:
at Examples.testSquareArea(Shapes.java:221)
actual:
expected:
900.0...................................900
--- END
OF TEST RESULTS ---
á
Fix the errors
using one of the text editors available on your computer, compile and run your
program again. When you succeed, you will see the following results:
----------------------------------
Tests for the class: Examples
Tester Prima v.1.3.4 - 16 November 2009
----------------------------------
Ran 18 tests.
All tests passed.
Issued 5 warnings of inexact comparison.
--- END OF TEST RESULTS ---