Wednesday, May 8, 2024
 Popular · Latest · Hot · Upcoming
10
rated 0 times [  10] [ 0]  / answers: 1 / hits: 59864  / 3 Years ago, fri, may 14, 2021, 11:08:58

I just installed Ubuntu and am Java 7u55 (JDK) and am trying to configure JAVA_HOME as an environment variable.



In ~/.bashrc I added:



# Exports
JAVA_HOME=/home/myuser/sandbox/java/7u55/jdk1.7.0_55
export PATH=$PATH:JAVA_HOME


Yet when I close the terminal and open a new shell and type which java or java -version Ubuntu doesn't seem to know what I'm talking about (says program java can be found in one of several packages and prompts me to use sudo apt-get to install one of them).



What am I doing wrong?


More From » java

 Answers
7

First, you have a typo in export line. It should be



export PATH=$PATH:$JAVA_HOME/bin


No space, add a $ character before JAVA_HOME, add /bin



However fixing above line may not fix your problem in installing java. The easiest way to install java is by using webup8 ppa:



sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer


After the last command, the script will automatically download the jdk from Oracle website and install it for you. You can read the tutorial here.


[#25861] Friday, May 14, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
doredtness

Total Points: 153
Total Questions: 113
Total Answers: 106

Location: South Georgia
Member since Fri, Nov 13, 2020
4 Years ago
;