Recently, I have helped others install the hadoop system and encountered various problems. When installing JDK, the source is poor, and the Manual installation cannot identify the environment variables. The problems and methods of JDK installation are summarized as follows.
There are two ways to install JDK in Ubuntu: one is automatic installation. The steps are as follows:
- Enter sudo apt-Get install sun-java6-jdk. (The premise is that the system source has been updated to an available source)
- Configure the environment variables for sudo/etc/profile. Add the following content to the file: Export java_home = (Java installation location, the automatic installation directory is/usr/lib/JVM/Java-6-Sun)
Export classpath = ".: $ java_home/lib: $ classpath" export Path = "$ java_home/: $ path"
- Java-verison verification and Installation
Method 1 requires a good source, but the Ubuntu source does not seem to have a few good updates, so most of them are not easy to use. At this time, only the second method is used, install JDK manually. The procedure for method 2 is as follows:
- Download the latest JDK installation package in http://java.sun.com, JDK-***-linux-i586.bin, put in directory with installation
- Enter the installation package directory under the terminal and enter sudo chmod U + x JDK-***-linux-i586.bin
- Then enter Sudo-S./JDK-***-linux-i586.bin to start the installation.
- Enter sudo/etc/profile to configure the environment variables. Step 2 in method 1.
- Enter Java-verison to verify Installation
- If the installation is successful, you must modify the default JDK directory in Ubuntu to the current installation directory. The procedure is as follows:
- Enter sudo Update-alternatives-install/usr/bin/Java (Java installation directory)/bin/Java 300 in the terminal
- Enter sudo Update-alternatives-install/usr/bin/javac (Java installation directory)/bin/javac 300 in the terminal.
- Run sudo Update-alternatives-config Java to confirm that the current installation directory is the JDK working directory.
- Enter Java-verison to verify Installation
So far, JDK installation is complete. Therefore, if the JDK environment variable configuration does not take effect during installation, you can configure it by referring to steps 7-9 in method 2. If this method does not work, you can only use the ultimate method: Enter the following command in the command line
Path = $ PATH :( Java installation directory)
Export path
This method is only temporary modification of environment variables, which is difficult after the machine is restarted.