Eclipse
main)
Command Line
SVN
Creating a new project in Eclipse
A new project with the name that you specified will appear in the Package Explorer tab in the left part of the Eclipse window.
Opening a project in Eclipse
Creating a new package in Eclipse
A new package with the name that you specified will appear within the project's src folder in the Package Explorer tab in the left part of the Eclipse window.
Creating a new class/interface in Eclipse
A new class (or interface) will appear within the package in the Package Explorer tab in the left part of the Eclipse window. An editor window will also open for the new class (or interface) with a stub implementation to be completed.
Running a Java program (i.e. main) in Eclipse
main method you wish to run.
The program will execute and any output generated will appear in the Console tab at the bottom of the Eclipse window.
NOTE: Pressing Shift-Apple-F11 will re-run the last executed program.
Running a Java program with command line arguments in Eclipse
main method you wish to run.
The program will execute given the command line arguments that you entered. Any output generated will appear in the Console tab at the bottom of the Eclipse window.
NOTE: Once the command line arguments have been entered they will continue to be used each time the program is run. Thus, subsequent runs can be done using the simpler method for running a program or by using the Shift-Apple-F11 shortcut. To change the command line arguments repeat the process given above.
Creating a new JUnit Test Case in Eclipse
A new class will appear beneath the class being tested in the Package Explorer tab in the left part of the Eclipse window. The name of the new class will be the name of the class being tested with "Test" appended to the end. An editor window will also open for the new test class with a stub implementation to be completed.
import static org.junit.Assert.*;
import org.junit.*;
Creating a new JUnit test method
@Test
public void testSomething() {
   fail("not implemented");
}
fail assertion in the body of the test method with your test.
The assertions that can be used in a JUnit test include:
fail("message")
assertEquals("messsage", expectedValue, actualValue)
actualValue does not equal the expectedValue. If expectedValue and actualValue are objects their .equals methods are used for the comparison.
assertFalse("messsage", value)
assertTrue("message", value)
assertNotNull("message", value)
assertNull("message", value)
assertNotSame("message", expectedObject, actualObject)
expectedObject and the actualObject are the same object (i.e. == is used for the comparision).
assertSame("message", expectedObject, actualObject)
expectedObject and the actualObject are not the same object (i.e. == is used for the comparision).
Running JUnit Test Cases in Eclipse
All of the test methods in the Test Case (or package, or project) that you selected will be executed. The JUnit tab will become active on the left side of the Eclipse window and will show you your test results.
Opening a terminal
If a terminal icon does not appear on the dock:
A terminal window will appear on the screen. The prompt will contain a ~ followed by your username (e.g. ~ braught$). This indicates that the current working directory is your home directory.
Listing files in a terminal
ls at the prompt in the terminal window.
A list of the files and directories contained in the current working directory will be displayed.
Changing directories in a terminal
cd followed by a space followed by the directory name at the prompt in the terminal window.
NOTE: the directory name entered following cd must be contained in the current working directory.
NOTE: to move upward out of a directory use cd .. (cd followed by a space, followed by two periods).
The prompt in the terminal will change to reflect the new current working directory. For example:
~ braught$ cd Documents
Documents braught$ cd ..
~ braught$
Running a Java program in a terminal
If the Java class to be run is not in a package:
.class file to be run.
java followed by a space, followed by the name of the class (without .class).
For example the following commands run the myClass program contained in the code directory contained in my Documents directory:
~ braught$ cd Documents
Documents braught$ cd code
code braught$ java myClass
If the Java class to be run is in a package:
java followed by a space, followed by the package name (with dots), followed by the name of the class (without .class).
For example the following commands run the myClass program contained in the myPack.test package that is stored in the code directory contained in my Documents directory:
~ braught$ cd Documents
Documents braught$ cd code
code braught$ java myPack.test.myClass
Setting up the SVN Repository
svn://turing.dickinson.edu/CompSci
Getting the Sample Code from the SVN Repository
The 132SampleCode project will now appear in the Package Explorer tab at the left of the Eclipse window.
Updating the Sample Code from the SVN Repository
Getting the Labs Project from the SVN Repository
The 132Labs project will now appear in the Package Explorer tab at the left of the Eclipse window.
Updating the Labs Project from the SVN Repository
Turning in the Labs Project to the SVN Repository