You can call Java to run your program, giving it the name part only (not the
$ java CreeperTest
That'sss a very niccce program you have there...
Hey, it worked! Congratulations—you've compiled and run your first piece of
code. Skip ahead to the Minecraft installation section that starts on page 23 .
Otherwise, let's see what might have gone wrong.
If the Java Command Is Not Found
The most likely error you'll see is “javac not found” or “java not found,” which
means that even though you installed Java, your shell couldn't find the java.exe
or javac.exe applications. Here's what's going on:
The commands you've used so far are either built in or were installed by the
BusyBox installer. But when you install Java, the computer may not know
where you put it.
When you go to type in the command javac , the computer needs to find an
executable named “javac” (on Windows it's javac.exe ; on Mac/Linux, it's just
javac ). There are a couple of standard places that it knows to look. On Windows,
that might include a directory like C:\Windows\System32 , and on Mac/Linux there
could be several directories, like /usr/bin , /usr/local/bin , and so on.
Because the system has its own commands that you shouldn't mess with, and
because you want to add your own commands to run, it turns out there are
a lot of places the computer needs to look! You can tell it exactly where to look
with a list of directory names. We call that your search path , or path for short.
You can see what's in the path for your shell window by typing this:
$ echo $PATH
For the shell/command-line processor to find a command to execute, it must
be in a directory that's in your search path. So you'll need to add Java's bin
directory to your path.
That directory's location depends on your operating system and what installer
you used. A typical location for Windows would be C:\ProgramFiles\Java\jdk1.7.0_67\bin
(your version numbers may be a little different).
On Mac, it's probably installed in /usr/bin or /usr/local/bin , both of which are
already in your path. But it might be installed someplace else completely, like
in /opt/local/java .