Background information on text editors and the terminal window
Text editors
For many tasks, it is convenient to use a text editor. On the Tome
Macs, the installed text editors include Xcode and Aquamacs. On your
own machine, you may wish to install another popular text editor such
as Sublime or Atom, but these are not installed by default on the Tome
Macs. Do not use the default Mac application called TextEdit, because
it sometimes doesn't save text in the right format.
Basic terminal commands
It is often convenient to issue commands directly to a computer
from a special type of window known as a "terminal." On a Mac, the
Terminal application launches a terminal window. Here are some basic
terminal commands:
- pwd: print working directory i.e. print the name of the directory you are currently in
- cd somewhere: change directory to the folder "somewhere" e.g. cd Desktop if you have saved your Java file on the desktop.
- ls: list contents of current directory
- ls -l: detailed listing of current directory
- ls -l *.java: list details of all Java files in the current directory
- ls -l SmallProgram.*: list details of all files whose names start with "SmallProgram."
- javac SmallProgram.java: compile the Java file SmallProgram.java
- java SmallProgram: run the main method in SmallProgram
- Don't forget, you can use the up-arrow key to go back to previous commands. And you can use the tab key to complete most commands.