Reputation: 103
I have downloaded jdk-7u9-linux-i586.rpm from oracle. Then I installed it in my Ubuntu 12.04 LTS. Then I set the environment path as :
export JAVA_HOME=/usr/java/<the jdk directory I cant recall now>
export PATH={$PATH}:{$JAVA_HOME}/bin
Then I checked by echo $PATH
and echo $JAVA_HOME
.
Now it is showing correct paths.
BUT THE PROBLEM IS : IF I TRY java
IN THE CONSOLE IT IS SHOWING UNRECOGNIZED COMMAND ERROR.
Please help me.
Upvotes: 1
Views: 6317
Reputation: 103
Finally I got it.
It was all my mistake. I have set the PATH variable in the /etc/environment file and it was set wrongly. I set it upto jdk folder and not /bin after that.
After changing it to bin, I logged out and logged in again.
Now it is working fine.
Sorry guys for wasting your time and efforts.
Upvotes: 0
Reputation: 61578
If you simply call export
in a shell, you will set the variables exactly for this one environment. If you want those variables to be there for all shell environments, add them to your ~/.bashrc
or your ~/.profile
files.
EDIT: I think, using a RedHat-specific packages (.rpm
) on Ubuntu may be a cause of your issue - this is a rather wild guess though. You could either remove your current installation and try a different package, or better yet, install java using your regular packgage manager:
sudo add-apt-repository ppa:webupd8team/java
apt-get update
sudo apt-get install oracle-java7-installer
Upvotes: 1
Reputation: 272427
You changed your PATH, but did you re-source and refresh your PATH cache ? (see here for more details, and check section 3)
e.g.
$ vi ~/.profile
$ . ~/.profile
$ echo $PATH # is this right ?
and a possible hash
$ hash
Upvotes: 2