简体   繁体   English

在Ubuntu 12.10中安装后无法识别JDK

[英]JDK not recognized after installation in Ubuntu 12.10

I did these steps without error: 我做了这些步骤没有错误:

  1. JDK path : JDK路径:

     Downloads/jdk-6u37-linux-x64.bin 
  2. Commands in Terminal: 终端中的命令:

     mkdir Programs cd Programs bash ../Downloads/jdk-6u37-linux-x64.bin ln -s jdk-6u37-linux-x64 jdk 
  3. 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, 干杯,

The scripts located here will help you install sun's jdk on Ubuntu. 这里的脚本将帮助您在Ubuntu上安装sun的jdk。 Really useful stuff. 真有用的东西。

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM