cd
(change directory) command to navigate
around the file system. The command cd ~
will put
you back into your home directory. Here's an example of setting
up a new directory for the assignment:> cd ~
Change directory to your home directory> mkdir cs206
Creates a new directory ~/cs206,
which is under your home directory> cd cs206
Moves into that directory> mkdir assignment0
Creates a new
directory ~/cs206/assignment0 > cd assignment0
Moves into that directory> emacs Assignment0.java &
&
at the end of the
calling line, you told Linux to launch emacs and then pass control back
to the Terminal, allowing you to use both simultaneously. You can
use it without the &
, in which case you won't be able
to use the terminal until you've exited emacs.> ls
Assignment0.java
> javac Assignment0.java
> java Assignment0
Hello World!
> javac Assignment0.java; java Assignment0
javac -version
to see if it can find javac. If it cannot, install the
Developers Tools CD that came with your Mac and use Software Update to
make sure you have the latest version.cd
command to change directories and navigate around the filesystem, same
as in Linux. However, other commands are different: use dir
instead of ls
, and the ~
is no longer a
shortcut to your home directory. Here is an overview
of MS-DOS commands, which may help you use the command prompt in
Windows.> c:
c:\> cd "c:\Users\Eric\"
c:\Users\Eric\> mkdir cs206
c:\Users\Eric\> cd cs206
c:\Users\Eric\cs206> mkdir assignment0
c:\Users\Eric\cs206> cd assignment0
dir
at the prompt). You can then compile and run it via:> javac Assignment0.java
> java Assignment0
Hello World!
java
should work fine). For example:>"c:\Program Files\Java\sdk7.x.x\bin\javac.exe"
Assignment0.java
javac
at the
terminal.
Capitalization doesn't matter. Click "Set", "OK" or "Apply".
The PATH can be a series of
directories separated by semi-colons (;). Microsoft
Windows looks for programs in the PATH directories in order, from left
to right. You should only have one bin directory for a Java SDK in
the path at a time (those following the first are ignored), so if one
is already present, you can update it to sdk7.x.x. Be sure to
replace the sdk version number with the version you're running.