Installing the JDKFrom WikiJavabuy this book
Installing the JDK is apparently simple, but we have to take care of few tricky points to do it properly. It's a simple procedure, but it's important to follow it to be sure to have everything properly installed.
the articlecheck that it installed wellThe meter we will use to verify if we have installed the JDK properly is simply to open a prompt (for example in windows XP it would be: Start -> Run, Type cmd and hit Enter) and insert the following two commands in the prompt: java -version javac -version These two commands print out the version information of the java virtual machine and java compiler we have in our computer configured as default one.
It is important that the version number is exactly the same for the JVM and the Java Compiler up to the update number (the fourth one). The result in your machine should look like follows: C:>java -version java version "1.6.0_10" Java(TM) SE Runtime Environment (build 1.6.0_10-b33) Java HotSpot(TM) Client VM (build 11.0-b15, mixed mode, sharing) C:>javac -version javac 1.6.0_10 As you can see the Java version I've installed on my computer is the 1.6.0_10 and I have both the JVM and the Java Compiler in the same version installed. My computer has the JDK installed properly. Since many computers have already a JRE installed when you install the JDK it's not always straightforward to get the JVM and Java Compiler on the same version. In the next paragraph I'll guide you to install the JDK properly. Installing the JDK properlyNote: this procedure refers to installing the JDK on a Windows XP machine, refer to this page for installing on a Linux machine. First of all we need to download the JDK, you can do this from this page which allows you do download several files, the one you will choose is the Java SE Development Kit (JDK) that bundles both the JDK and the JRE. Select the best settings for your computer and select to download the Offline Installation by clicking on the link. Once we have downloaded the JDK bundle on our hard disk we need to install it. To do so simply execute the installation file that we have downloaded. Normally all the default settings work fine. Mind that the Install the JRE checkbox is selected. Take note of the directories to which you are installing both the JDK and the JRE, they may come useful later on if problems arise. The third phase is to verify that the installation was successful, to do so we follow the procedure described in the previous paragraph: open a command prompt and execute the two commands java -version javac -version If the version numbers are the same, then everything went perfect and we don't need to go any further, if the version numbers differ or the prompt said that the commands did not exist, read the next paragraph to fix your installation. Fixing the JDK installationIt is very common that the version numbers do not match or that the javac command is not found. The first is because very often computers have already the JRE installed and the procedure of installing the JDK does not override the configurations of the JRE. The second is because the JDK installation doesn't configure the system to have the javac in the execution path. Make the commands to be foundIf the javac command was not found you need to follow this procedure to put the directory containing it in the execution path. To solve this we need to add the bin directory of the JDK in the execution path. To do so you need to find the installation directory, called home directory, of your JDK (normally it's c:\Program Files\Java\JDKw.x.y_z -where w.x.y_z is the version you installed-). The bin directory is the subdirectory bin of the home directory. so if the home directory is C:\Program Files\Java\jdk1.6.0_10 the bin directory that we need to put in the execution path is C:\Program Files\Java\jdk1.6.0_10\bin. Open your System Manager (Start -> Control Panel -> System) and select Advanced then hit the button environment variables. Find in the bottom list the variable called Path and double click on it. In the window verify that the path to your bin directory (in the example it would be the C:\Program Files\Java\jdk1.6.0_10\bin) is included in the list. In case it was the JRE not to be found follow this same procedure but use the JRE home directory instead. The versions are differentTo fix this we need to be sure that the execution path contains the paths to the correct JRE and JDK bin directories with the same procedure explained above. After checking that the path is set correctly we need to create a new environment variable called JAVA_HOME and point it to the JDK home directory (most often C:\Program Files\Java\jdk1.6.0_10). Setting the JAVA_HOME environment variable solves also when you have another common problem which you may incur when starting to use the compiler. If the compiler tells you that it can't find the tools.jar file then it means that the JAVA_HOME is not set correctly. See AlsoJDK download site, install JDK under Linux |

The JAVA_HOME directory should be set to C:\Program Files\Java\jdk1.6.0_10 and not C:\Program Files\Java\jdk1.6.0_10\bin
--59.160.74.254 09:30, 10 April 2009 (UTC)