- Download the latest JDK package from http://java.sun.com
- Copy the JDK package to your Home Folder. We assume the file name: jdk-6u16-linux-i586.bin
- Sign terminal and login as super user
password:
- Do unpack the file to the JDK
- License agrément will appear, type 'yes'
- The process of unpacking will take place and when completed it will create a directory '/ usr/java/jdk1.6.0_16'. We call this directory as the value of the variable JAVA_HOME.
- Up to here JDK already installed and you can install your favorite Java IDE, like NetBeans or Eclipse.
- But if you want to be able to compile through terminal, you have to set CLASSPATH first.
- The trick is to define the value of the variable JAVA_HOME and PATH:
export PATH = $ JAVA_HOME / bin: $ PATH
- To check if the value of the two variables have been updated, do this:
echo $ PATH
If both displays output, then the two variables defining the success
- Up to here CLASSPATH has been set and you are able to compile through terminal. To test it do:
java-version
- But the problem is, when you close the terminal then you have to go back CLASSPATH settings. This certainly was not wearing. So, you need to update the file. Bashrc to add information about your CLASSPATH to be set
- Open the file. Bashrc:
if there is a message 'permission denied', then write it: nano ~ /. bashrc
- At the end of the file to add information about the CLASSPATH and save:
PATH = $ JAVA_HOME / bin: $ PATH
- And now, you can directly compile java file through the terminal.
0 comments:
Post a Comment