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
  • It's not about installing the Java in general, I need to find out, why my method is not working. It's littler different to that. and making in duplicate won't solve my problem. I am googling this issue my self, then if you people mark each such issue unanswerable, then it's not helpful. – vicky Feb 05 '16 at 14:32
  • 1
    What installation / configuration method did you use? All we can see from your question as it stands is that you set a JAVA_HOME variable - there's usually more to it than that (e.g. configuring the update-alternatives mechanism or manually adding / symlinking the binary path) – steeldriver Feb 05 '16 at 14:52
  • @steeldriver yes, that kind a answer I was looking at where my configuration is lacking. thanks. is it related to Java or to other software as well which are used for the development ? – vicky Feb 05 '16 at 15:05
  • I got my answer from WikiHow at the following URL http://www.wikihow.com/Install-Oracle-Java-on-Ubuntu-Linux – vicky Feb 05 '16 at 15:45
  • Yes, see step 9, where they have you set your PATH. ;-) – inanutshellus Feb 05 '16 at 16:04

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