Welcome to the Core Java FAQ!

Question: What is the difference between the various editions?


First (JDK 1.0) edition:
Objects. Inheritance. Interfaces. Graphics. AWT. Applets. Data Structures. Streams. Multithreading. Network programming.
Second (JDK 1.02) edition:
Additional topics: Object streams. JDBC. RMI. Native methods.
Third (JDK 1.1) Edition:
Split into a two volume set. Additional topics in volume 1: Inner classes. Events. Printing. JAR files. In volume 2: Security. Signed applets. Advanced AWT. JavaBeans.
Fourth (Java SE 1.2) Edition:
Moved streams to volume 1. Additional topics in volume 1: Swing. Java Plug-In. All examples have been rewritten to use Swing. Additional topics in volume 2: 2D Graphics. Advanced Swing components. Container classes.
Fifth (Java SE 1.3/1.4) Edition:
Rewrite of first six chapters. Proxies. Additional debugging tips. Moved some Swing components from volume 2. Code with line numbers. Figures more UML compliant. More Unix/Linux coverage. Removed corejava package.
Sixth (Java SE 1.4) Edition:
Added coverage of 1.4 features: Logging, regular expressions, NIO file channels, preferences API, Java Web Start,  formatted text fields,  new focus architecture, more events (mouse wheel etc.), new frame functionality, spinners, spring layouts, assertions. Numerous bug fixes and updates throughout all chapters.
Seventh (Java SE 5.0) Edition
Added coverage of 5.0 features: Generic classes, autoboxing, varargs, enumerated types, annotations, java.util.concurrent. Numerous bug fixes and updates throughout all chapters.
8th (Java SE 6) Edition
Coverage of Java SE 6 features. Collections and multithreading moved to volume 1. New material on Swing and AWT enhancements, compiler and scripting APIs. Numerous bug fixes and updates throughout all chapters.
9th (Java 7) Edition
Coverage of Java 7. Resource management. Diamond operator. Other miscellaneous Java 7 features. Numerous bug fixes and updates throughout all chapters.
10th (Java 8) Edition
Coverage of Java 8. Default and static methods in interfaces. Lambda expressions. Concurrency enhancements. Streams. Date and time library. Removed JavaBeans, RMI. Numerous bug fixes and updates throughout all chapters.

Question: I have the 10th/9th/8th/7th edition of Core Java. Why do most of the sample programs have compiler errors?

Answer: Make sure that the language level of your IDE is set to Java 8/7/6/5.

Question: I own an older version of the book. Can I upgrade to a newer version at a reduced price? Do you have the new chapters available for free?

Answer: Unfortunately no. There are numerous revisions in all chapters, so it isn't just a matter of giving out the new chapters for free. We looked at offering a rebate if you turn in your old copy to the bookstore, but the bookstores balked at that.

Question: In chapter 2 of volume 1, you write: “Open a shell or terminal window”. I use Windows/Macintosh, and I've never done that. Now what?

Answer: Under Windows, select the MS-DOS or Command Prompt application from the start menu. There are many tutorials on the net—you may want to search Google to find one that you like.

On Mac OS X, run the Terminal application. 

Question: Why doesn't any of the code compile? Or, why does some of the code compile and some of it gives error messages about missing classes?

Answer: It is the path and/or class path.

Do the following. First, deactivate any Java installation that you may have. That is, temporarily remove the JDK you downloaded yesterday, the beta test of the nifty new environment that your brother in law gave you, etc. Install the JDK from the Oracle web site. Download the Core Java files from this web site. Set the path and remove any class path settings. Reboot. Double-check that the class path is either unset or contains the current directory (.). Keep trying. This stuff always works out eventually.

I have had to deal with hundreds of users who swore that they did everything right, except they sheepishly admitted a couple of emails later that they didn't pay attention to capitalization, thought that there was no essential difference between a ; and a :, thought it was ok to add a few spaces to "improve" on the looks of the class path, didn't want to go through the trouble of deactivating their old version of Java, or whatever. Please: If the Java interpreter can't find some or all of the classes, check your path and class path, and don't report it as an error. Thanks!

Question: Why I does my code compile but not run?

Answer: This can happen if you have a class path but you forget to add the current directory(.) into it. This is because system classes (the ones in rt.jar) are always part of the class path. The current directory is also automatically searched if no explicit class path is provided. However, if an explicit class path is provided, the current directory is automatically searched by javac but not by java.

Question: Why don't the applets work in my browser?

Answer: You need to install and activate the Java Plug-in to run Java applets in your browser. This installation has never been easy and has been getting harder because browser makers have mistrusted Java, sometimes for good reason when Oracle dragged its feet on closing security loopholes. At this point, your best bet is to use Firefox for experimenting with applets.

Question: The RMI examples don't work, even though I did everything exactly like in the book.

Answer: The RMI setup is complex and it is very easy to get some detail wrong. Also, remember to always erase unneeded class files and to restart the naming service whenever you make a change in the configuration. Keep trying--it'll work eventually.