JDK (Java Development Kit) is a software that provides development tools for creating Java programs.
Installation
First we must download the package from the java website, select your platform, in our case Linux:
http://www.oracle.com/technetwork/java/javase/downloads/index.html
Here we go down the file "jdk-6u21-linux-i586.bin" to any folder, then leave where appropriate.
Now we have to give execute permissions:
sudo chmod +x jdk-6u23-linux-i586.bin
and install:
sudo ./jdk-6u23-linux-i586.bin
Now move the generated folder to a more appropriate directory:
sudo mv jdk1.6.0_23/ /usr/local
We set the new Java as one of the alternatives "java"
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/local/jdk1.6.0_23/bin/java" 1
Now we set the "new alternative" as real Java. This step makes the sun is the version used by default:
sudo update-alternatives --set java /usr/local/jdk1.6.0_23/bin/java
Now we do the same steps above for javac:
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/local/jdk1.6.0_23/bin/javac" 1
sudo update-alternatives --set javac /usr/local/jdk1.6.0_23/bin/javac
Now verify that everything works properly. Open the console and type:
java -version
If all is well, you should return the following:
java version "1.6.0_23"
Java (TM) SE Runtime Environment (build 1.6.0_23-B06)
Java HotSpot (TM) Client VM (build 17.0-b16, mixed mode, sharing)
For javac:
javac -version
If all is well back:
javac 1.6.0_23
If you have other installations of java / javac can be configured using the following commands:
sudo update-alternatives --config java
sudo update-alternatives --config javac
Also if you want setear JRE_HOME JAVA_HOME or as environment variables, we must go to:
sudo gedit /etc/environment
Here we record the routes where we have installed Java, in our case is as follows:
JAVA_HOME = "/usr/local/jdk1.6.0_23/bin/" (add)
JRE_HOME = "/usr/local/jdk1.6.0_23/jre" (add)
PATH ="...(other routes):$JAVA_HOME:$JRE_HOME (edit)
With this we finish the installation.
0 comments:
Post a Comment