The Tutorial-Wizards Easiest Tutorials On The Web

Java Basic – Installing Java Compiler

Author: Dan1601

Aim: To download and install the Java Development Kit (JDK), so that we can compile our Java code.

Requirements: Basic computer skills.

Howto: We need to download the compiler, install it, and possibly fix some problems.

  1. First off, we need to go to the Oracle downloads page, and download the latest version of the JDK.
  2. Once we've downloded the appropriate version of JDK for your system, simply run the downloaded file, and wait for it to install. There is one stage where it seems to have frozen, but just wait, and it will eventually complete.
    • If it doesn't complete, like it did for me, just exit, and we'll need to finish the part it got stuck on manually. We'll do this in the troubleshooting section.
  3. To run the compiler once it has been installed correctly, open a command prompt (for windows) window, and change to the directory in which your .java file is.
    • If you're not familiar with command prompt commands, changing directory is as simple as typing cd directory. The directory being the location of your file, relative to your current position.
  4. In the command prompt window, in the same directory as your .java file, use the command javac to compile the file. It's at this point where it will tell you if the compilation was successful. If there are any errors, it won't compile, and will give you a list of errors that prevent it from being compiled. The errors are usually clear, but if you get one you don't understand, look it up.
  5. To run your file, in the command prompt window, type java NameOfYourClass.class. Note, that your .class file won't be called the same as your .java file; it will be called whatever the name of your class is in your .java file (Don't worry, I'll explain classes and stuff in later tutorials).

Why didn't it finish installing properly? I'mnot sure of the exact reason, probably something to do with file altering permissions.. To complete the install manually, follow these steps:

  • Select Start > My Computer > Properties > Advanced > Environment Variables > System variables > PATH (for Vista - might be slightly different for different OSs.
  • Edit the PATH value, so that C:\Program Files\Java\jdk1.6.0_23\bin; is added to the beginning.

This should be the only thing that was missed if you stopped the installation after it appeared to freeze.

Comments (0) Trackbacks (0)

No comments yet.

Leave a comment

Trackbacks are disabled.