[英]JDK not recognized after installation in Ubuntu 12.10
I did these steps without error: 我做了这些步骤没有错误:
JDK path : JDK路径:
Downloads/jdk-6u37-linux-x64.bin
Commands in Terminal: 终端中的命令:
mkdir Programs cd Programs bash ../Downloads/jdk-6u37-linux-x64.bin ln -s jdk-6u37-linux-x64 jdk
Set JAVA_HOME and Path: 设置JAVA_HOME和路径:
I added the following lines to the end of the .bashrc
file: 我在.bashrc
文件的末尾添加了以下行:
export JAVA_HOME=$Home/Programs/jdk export PATH=:$JAVA_HOME/bin:$PATH
This is the result of executing the command echo $JAVA_HOME
: 这是执行命令echo $JAVA_HOME
:
/Programs/jdk
This is the result of executing the command echo $PATH
: 这是执行命令echo $PATH
:
:/Programs/jdk/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games1
And the problem is: 问题是:
This is the result of executing the command 这是执行命令的结果
$ java -version
The program 'java' can be found in the following packages:
* default-jre
* gcj-4.6-jre-headless
* gcj-4.7-jre-headless
* openjdk-7-jre-headless
* openjdk-6-jre-headless
Try: sudo apt-get install
I think the problem is that environment variables are case sensitive in linux, so your 我认为问题是环境变量在linux中区分大小写,所以你的
export JAVA_HOME=$Home/Programs/jdk
Should be 应该
export JAVA_HOME=$HOME/Programs/jdk
In your echo $JAVA_HOME
output you can see that you don't get your /home/yourname
prepended... 在echo $JAVA_HOME
输出中,您可以看到您没有获得/home/yourname
前置...
Hope that helps. 希望有所帮助。
Cheers, 干杯,
try this command 试试这个命令
sudo update-alternatives --config java
This will list all the Java versions installed and configured. 这将列出已安装和配置的所有Java版本。
If you see one or more installs, it will give you a list each element starting with a number. 如果您看到一个或多个安装,它将为您列出每个以数字开头的元素。 Just choose the number that corresponds to the version you want to use by default. 只需选择与默认情况下要使用的版本对应的编号。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.