If your coding experience comes from Visual Basic or Visual C++, you are accustomed to a development environment with a built-in text editor and menus to compile and launch a program along with an integrated debugger. The basic Java SDK contains nothing even remotely similar. Everything is done by typing in commands in a shell window. We tell you how to install and use the basic Java SDK, because we have found that the full-fledged development environments don't necessarily make it easy to learn Java—they can be complex and they hide some of the interesting and important details from the programmer. Integrated development environments tend to be more cumbersome to use for a simple program since they are slower, require more powerful computers, and often require a somewhat tedious project setup for each program you write. These environments have the edge if you write larger Java programs consisting of many source files. And these environments also supply debuggers, which are certainly necessary for serious development—the command-line debugger that comes for free with the Java SDK is extremely awkward to use. We will show you how to get started with the Sun ONE Studio Community version, a freely available development environment that is itself written in Java. (Before the eager beavers from the Sun marketing department sprung into action, the program was known as Forte.) Of course, if you already have a development environment such as JBuilder, CodeWarrior or Café that supports the current version of Java, then you can certainly use it with this tutorial. For simple programs, a good middle ground between command-line tools and an integrated development environment is an editor that integrates with the Java SDK. On Linux, our preferred choice is Emacs. On Windows, we also like TextPad, an excellent shareware coding editor for Windows with good Java integration. Finally, JEdit is an excellent cross-platform alternative. Using a text editor with Java SDK integration can make developing Java programs easy and fast. We used that approach for developing and testing most of the programs in this tutorial. Since you can compile and execute source code from within the editor, it can become your de facto development environment as you work through this tutorial. In sum, you have three choices for a development environment:
- Use the Java SDK and your favorite text editor. Compile and launch programs in a command shell.
- Use the Java SDK and a text editor that is integrated with the Java SDK. Emacs, TextPad, and JEdit have this capability, and there are many others. Compile and launch programs inside the editor.
- Use an integrated development environment such as the free Sun ONE Studio Community version, or one of many other freely or commercially available development environments.