0

I have installed the oracle Java 8 and configure it.

cmd-> echo $JAVA_HOME
/usr/lib/jvm/oracle_jdk8
cmd-> echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
my oraclejdk.sh file:

cmd->java -version
The program 'java' can be found in the following packages:
 * default-jre
 * gcj-4.9-jre-headless
 * openjdk-7-jre-headless
 * gcj-4.8-jre-headless
 * openjdk-6-jre-headless
 * openjdk-8-jre-headless
Try: sudo apt-get install <selected package>

my oraclejdk.sh It's got empty accidentally now. I logged out couple of times, but still getting above results. I had export commands in it which I don't remember now.

Can you please help me in getting Java running on Ubuntu.

Note Duplicate: My question is not related to that mentioned answers. I have a configuration issue, where half echo $JAVA_HOME is showing that Java is installed, but Java -version can't locate the installed Java.

vicky
  • 101

1 Answers1

1

You need to add $JAVA_HOME/bin to your PATH

You can verify this easily:

$ PATH=$PATH:$JAVA_HOME/bin
$ java -version

After you've verified it works, edit your ~/.bashrc file to include the line

export PATH=$PATH:$JAVA_HOME/bin