Chances are your mac is set up and ready to go out of the box. Just follow the below steps to
test it.
1. Right click on your desktop, and create a new folder. Name the folder Java.2
2. If you aren't familiar with spotlight, open it up by pushing and holding the command key (key with an apple on it) and the space bar. Spotlight will spew forth from the upper right hand corner of your screen most likely.
3. Type the world terminal. You'll see it work at first, then you see a bunch of sub areas within spotlight such as Top Hit, Applications, Definition, so on and so forth. Next to applications you'll see a little black box and the
word terminal. Click it, that's the one you want.
4. Your terminal application will open and you'll see your prompt. Mine looks like
5. Type the following
My prompt changed to nathans-macbook-pro: Java Nathan$
6. Type pico HelloMac.java
7. Your terminal app will morph into what appears to be a text editor. Type the following into it
8. Push and hold control, then the x button. Then hit enter. Your prompt should return to normal.
9. Type javac HelloMac.java
10. Type java HelloMac and
you should see Hello, Mac! displayed in your terminal. Doing that let's you know it works. That should also set you up for using your terminal and spotlight.
If you want to use TextEdit for your editor, you'll need to set it up a bit at first before you can effectively use it to start going through the book. But before you do that, you'll want to open up your Java folder, and drag the HelloMac.java and HelloMac.class files you see into the trash.
1. Using spotlight, open textedit
2. With textedit open, select the preferences, or use the keyboard shortcut by pressing and holding the command key and pushing the comma key.
3. Under the word Format, make sure the button next to plain text is highlighted. By default the one next to rich text most likely is.
4. Go the to Open and Save tab, and make sure you select the option to automagically at .txt if you don't specify a file extension. This will save you heartache if you use .txt files a lot.
5. You can make sure the above will now work for you by pushing and holding the command key, then hitting the q key after you save your changes to your preferences. command q is the mac keyboard shortcut for quit. After you do that reopen textedit, copy and paste the above code into it, then from the file menu choose save as.
6. Navigate to your Java folder, and save it as HelloMac.java and remember that you have to type out .java after the name of the file in order to let the computer know that's the extension you want it as. If you don't, it will add .txt and make it into a simple text file, and when you try to use your compiler it won't be happy.
7. After saving your file, open up your terminal and navigate to your java folder if you aren't there already. Unless you hard closed it it should already be there though.
8. Follow steps 9 and 10 above, and you should see Hello, Mac! displayed once again.
As mentioned there are better text editors and there are IDEs to use as well. Also as David Newton said you should become familiar with some of the features on your mac as they can save you time and help you get around. Also reading a good bash tutorial and saving it in your favorites would be good.
If you have any problems don't hesitate to ask. Good luck and happy coding.