I here to Ubuntu9.04 as an example (a) first download JDK, here is (jdk-6u14-linux-i586.bin) is not recommended to use. RPM can be used only when rpm is converted to deb in Ubuntu, but many more steps are involved. (2) Start the Ubuntu terminal and switch to the root account to log on: sudosu switches to the root permission sudopasswdroot. Here we set a password for the root account.
Take Ubuntu9.04 as an example.
(A) First download JDK, here is (jdk-6u14-linux-i586.bin) is not recommended to use. RPM because in Ubuntu rpm also need to be converted to deb to use, but a lot more steps.
(2) Start Ubuntu to open the terminal and switch to the root account to log on:
Sudo su
Switch to root permission
Sudo passwd root
Set a password for the root account. The root account is enabled.
Next, log out and log on to Ubuntu as the root user.
(3) After logging on as root, create a folder under/usr/lib and name it jvm.
You can also use the graphical interface. The terminal is mkdir jvm (note: the terminal is located under/usr/lib)
Go back to the jdk-6u14-linux-i586.bin directory and move the jdk-6u14-linux-i586.bin to the jvm file:
Music jdk-6u14-linux-i586.bin/usr/lib/jvm
(4) install JDK
Make sure that the terminal is in/usr/lib/jvm and then run
Sudo./jdk-6u14-linux-i586.bin
If More appears at this time, press enter until you are prompted to enter yes or no, and enter y
Wait until "... Done! "Or something, just install it.
At this time/usr/lib/jvm will have a jdk-6u14-linux-i586 folder with everything in it
(5) environment variable configuration
The Configuration value of environment variables in linux is mainly about modifying/etc/enviroment.
Modify the enviroment File
Sudo gedit/etc/enviroment
Then edit enviroment:
PATH = ". :/usr/lib/jvm/jdk1.6.0 _ 14/bin:/usr/lib/jvm/jdk1.6.0 _ 14/lib: /usr/lib/jvm/jdk1.6.0 _ 14/jre/bin:/usr/lib/jvm/jdk1.6.0 _ 14/jre/lib:/usr/local/sbin: /usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
CLASSPATH = ".:/usr/lib/jvm/jdk1.6.0 _ 14/lib"
JAVA_HOME = "/usr/lib/jvm/jdk1.6.0 _ 14"
Save files
Log out and log on again.
(6) test
Open terminal Input
Java
Javac
The Correct prompt is displayed, indicating that the installation is successful!