Thursday, November 12, 2009

How to Install Java on Windows

In studying Java, sometimes small things can really bother us. Especially for those of us just beginning to learn, even when creating "Hello World" error alone can make us dizzy. My experience at configure time to create my CLASSPATH mumet, fortunately there was an uncle Google. Praise the problem solved thanks to the permission of Allah, and I went on journey of learning Java.For that I want a little more reader friendly as well help in setting JAVA_HOME, PATH, and CLASSPATH. Not that I'm already proficient in Java, but from what I know that "science is useful is the knowledge that is useful for others". While I only writing for Windows 7 Operating System.

To be able to use JAVA we must have a JDK and JRE on our computers. JVM can be obtained by installing the JDK, first download the installation files from http://www.java.sun.com accordance with the appropriate platform. JDK is available for Linux, Solaris and Windows. For the JRE, is included when we download the JDK.

Directory containing the JDK has been properly installed on a computer known as JAVA_HOME. This variable JAVA_HOME was not really matter if we only use J2SE features, but very useful for development using J2EE, such as when using Apache Tomcat and others.

In the JDK is installed on our computers, there are java programs (for running programs) and javac (java compiler, to compile java programs) are in sub-bin directory under JAVA_HOME. To be able to compile and run Java programs from any directory, it must be added JAVA_HOME \ bin to the PATH environment variable name.

The steps to add the JAVA_HOME variable to the environment variable in Windows 7, as follows:
  1. Right-click Computer, then click Properties
  2. Select Advanced system settings
  3. After the System Properties window appears, select the Advanced tab
  4. Click Environment Variables, it will appear Environment Variables window
  5. To add JAVA_HOME, click New
  6. Type JAVA_HOME in the Variable name
  7. Insert the address of the directory where the JDK is installed in the Variable value, for example C:\Program Files\Java\jdk1.6.0_16
  8. Click OK
And then, we must create the PATH variable. The steps to create the PATH variable is essentially the same as the steps to create a variable JAVA_HOME, but to remember that the PATH variable is usually already there before. So for the PATH variable, do not need to create a new variable that will remove an existing one.

The steps as follows:
  1. Find and select the PATH variable in System Variables table of previously configured on the computer
  2. Click Edit, then add C:\Program Files\Java\jdk1.6.0_16\bin in the Variable value
  3. Click OK

Remember, the Windows operating system, can be include multiple locations or addresses to the environment variable like PATH variable with records must use a semicolon (;) as a separator. For example the value of the PATH variable:

C:\Program Files\Java\jdk1.6.0_16\bin;%SystemRoot%\system32;%SystemRoot

When finished configuring the PATH variable, test whether the configuration is working properly by running through the Command Prompt java.exe. At the prompt type java-version. If this kind of output appears the PATH configuration has worked well.

C:\Users\paiman>javac -version
javac 1.6.0_16

C:\Users\paiman>java -version
java version "1.6.0_16"
Java(TM) SE Runtime Environment (build 1.6.0_16-b01)
Java HotSpot(TM) Client VM (build 14.2-b01, mixed mode, sharing)


0 comments: