Java 7 for Absolute Beginners

(nextflipdebug5) #1

CHAPTER 1 ■ WRITING YOUR FIRST JAVA PROGRAM


■ Note If you don't have administrator rights on your computer, clear (that is, uncheck) the checkbox that lets
you install the program for all users. This enables you to still install the JDK.I would provide more details, but the
web site changes from time to time, so more detailed instructions would probably be wrong (and confusing and
irritating).

You can put the JDK anywhere you'd put any other program. The default location works just fine.

Installing Eclipse


Eclipse is an IDE. Basically, it provides a convenient tool for writing and testing your programs. Among
other things, it identifies your errors as you make them, which makes correcting them much easier and
faster than writing code in a text file and compiling it from the command line. Eclipse also colors parts of
your code. After you get used to the color scheme (which happens very quickly), you'll be able to write
code more quickly.
Again, before you can install Eclipse, you have to download it. To do so, follow these steps:


  1. Open http://www.eclipse.org/downloads/ in a web browser.

  2. Find the EEclipse IDE for Java Developers choice and select the 32-bit version.


■ Note If you have a 64-bit operating system, choose the 32-bit version of Eclipse anyway. At the time of this
writing, the 64-bit version of Eclipse has issues that make Java development more difficult than it needs to be.


  1. Follow the instructions provided by the web site.

  2. Run the installer and accept any defaults.


Again, I would try to provide more detail, but the web site changes from time to time, so more
detailed instructions would probably be wrong (and so confusing and irritating).
You can put Eclipse anywhere you'd put any other program. Again, the default location works
just fine.

Creating Your First Project


When you use Eclipse, you have to create a separate project for each program. That way, Eclipse can
keep the details of one program separate from another. Each project consists of the source code files you
write for your program and, potentially, a number of other resources that you might attach to a program.
For example, you might include images and files that contain settings to load at run time and many
other possible items.
Free download pdf