Core Java 2 - Volume I - Fundamentals, 5th Ed.
Getting Ready to Code
Chapter 2 is really all about getting set up to write programs. If you learned to code on a multi user system like UNIX or Multics then this will be cake.
(I'm not that old, SJU just took a while to get with networks and the comp sci students, and myself in particular, were vastly better off for it. Being students during the transition we were exposed to command line multi user environments, preparing code in emacs and compiling (or interpreting) from the command line. Then we moved onto Windows based PC's and Integrated Development Environments (IDEs) such as Turbo Pascal or Turbo C/C++. We caught a break and got the best of both worlds. If you had a similar background you'd know that NT and W2K are just trying to copy the functionality UNIX has had all along and bring it to the uninitiated masses)
Sorry about the self serving history lesson, but it glides into the subject of Chapter 2. First, any questions you have after the run through can probably be answered by the Java FAQ and you can keep current with the Java world at Sun's Java Home page
First your system needs to have four things happen
1. Load the Java SDK 1.4 on your system. That's the Software Development Kit for you newbies and it's basically the compiler, interpreter, and bytecode for the libraries. It comes with the book.
2. Add the SDK to your path so you can compile and run wherever. (This is system specific obviously)
3. Load the Java API (Application Programmer's Interface) documentation and the Library source files on your local machine. The convenience of this is beyond description. The source is in a jar (like zip) file on the Core Java 2 CD-ROM and the Java API documentation is on Sun's java site. Then there's even MORE source code, for the compiler, the virtual machine (the interpreter) and much more from the Community Source page. Then, lastly, you can load the code that appears in the book onto your local machine.
4. Loading an IDE or your favorite text editor (I used Forte and it was great, but now I use Borland's JBuilder and also play around with Netbeans.) Sometimes using the IDE is tedious in the beginning because you don't know how to use it yet and everything seems a bit overwhelming. After you load it go get a coffee or a beer and just tinker for a bit. Use the tutorial under help and create a demo app. All the IDEs come with tutorial help. Take your time. After a while you'll wonder what all the trepidation was about and you'll be whipping through projects like nothing. When you get to visual programming, design layout, and swing classes you will wonder how in the world the command line folk get along.
Then there's three ways to create and run code using java..
1. Use an IDE. Try JBuilder Personal. Try Sun One ($$$). Try Netbeans. It's FREE! They're all good...
2. Use your favorite text editor, compile to bytecode using JAVAC to create a ".class" file, and run it with the JAVA interpreter from the command line. Try the beginner tutorial if you're having hassles running from the command line.
3. Use a text editor that integrates the JDK and allows you to run your progs from the editor (IDE light). There are versions of emacs, xemacs and TextPad (comes with the book) that all have integrated java SDK support. You can always get emacs at GNU and Xemacs is on the web too.
Applets
The book then goes on to show you how to use the applet viewer. As you may know, an applet is java code that runs inside a web page (actually the applet tag tells your browser to take the .class file you point it to and run it.) and acts like a regular application (almost). Well, what if you don't feel like making a dummy web page and publishing it just to see if your applet works? That's where the applet viewer comes in. It comes with the Core Java 2 book and is easy to use. This is mostly for command line folk as JBuilder and integrated text editors let you check applets from inside their environments.
Now you have the background and the software, so we're ready to start banging out some code...
Send mail to lars@sorcon.com with
questions or comments about this web site.
Copyright © 2004 Sorensen Consulting