domingo, 20 de maio de 2012

How To Install Java 7 In Ubuntu 12.04


Because we are using old software in my school, my professor advised not to install java 7 and instead we should use java 6. However, im going to use java 7 for two reasons:

  • Im going to use java for developing android apps.
  • Java 6 is reaching its end of life;
  • And Oracle has decided to nullify any license allowing distros to maintain Java in their repos;
So, the easiest way i found to install java 7:


  1. Add this PPA's:


  2. Install and enter the config:


  3. And set witch jvm will you use:
Kudos to webupd8 and Eugene San

Confirm that java is installed by typing "java -version" and "javac -version"

Now... like me, you may want to define your $JAVA_HOME and $PATH variables

By default your java should be in "/usr/lib/jvm/java-7-oracle" (if not, don't worry, use your directory).
Open your terminal and type "sudo nano /etc/bash.bashrc"* (im using "nano" but you can use "gedit" or other editor).
Add this lines to the end of the file:
"export JAVA_HOME=/usr/lib/jvm/java-7-oracle"
"export PATH=$PATH:$JAVA_HOME/bin"

Save it and close it. To confirm that everything is working, log out and log in again, open a terminal and type: "echo $JAVA_HOME". The output should be something like "/usr/lib/jvm/java-7-oracle".


*if the variable is not set try using the file "~/.bashrc" instead of  "/etc/bash.bashrc"

Sem comentários:

Enviar um comentário