Why can't I install JAVA_HOME VARIABLE on Ubuntu 12.04?

I'm having difficulty installing JDK on Ubuntu, I can't get it to work. Can someone tell me what I'm doing wrong?

1- I downloaded jdk-6u35-linux-i586.bin from the oracle website

2- I moved the downloaded file home /

3- I converted it to an executable using chmod + x jdk-6u35-linux-i586.bin

4- I executed it with sudo./jdk1.6.0_35

5- I moved the folder using jdk to / usr / local using mv jdk1.6.0_35 // usr / local /

6- I opened .bashrc with the "kate" editor, and I added the following lines (this file was completely empty, by the way)

export JAVA_HOME = / usr / local / jdk1.6.0_35 /

export PATH = $ JAVA_HOME / bin: $ PATH

7- I typed a java version but did not work. This displays the console

enter image description here

+4
source share
4 answers

.bashrc starts when Bash starts, so your changes to it will not work for one session. Try to open a new window and run the command.

+3
source

Update the sudo command and try:

 sudo apt-get install sun-java6-jdk 

A type:

 java -version 

to check

If this fails, go to the Software centre , you should find the java JDK in the Developer tools category.

0
source

Try also

 update-java-alternatives usage: update-java-alternatives [--jre-headless] [--jre] [--plugin] [ -t|--test|-v|--verbose] -l|--list [<jname>] -s|--set <jname> -a|--auto -h|-?|--help 

or

 sudo update-alternatives --install "/usr/bin/java" "java" "/usr/jdk1.6.0_35/bin/java" 2 sudo update-alternatives --install "/usr/bin/javac" "java" "/usr/jdk1.6.0_35/bin/javaws" 2 sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/jdk1.6.0_35/bin/javaws" 2 

then switch

0
source

I am adding a .bashrc file to the end

export JAVA_HOME = "/home/apps/jdk1.7.0_13" PATH = $ JAVA_HOME / bin: $ PATH

0
source

Source: https://habr.com/ru/post/1433470/


All Articles