<tfoot id='avS1z'></tfoot>

  1. <small id='avS1z'></small><noframes id='avS1z'>

  2. <legend id='avS1z'><style id='avS1z'><dir id='avS1z'><q id='avS1z'></q></dir></style></legend>
    • <bdo id='avS1z'></bdo><ul id='avS1z'></ul>

      <i id='avS1z'><tr id='avS1z'><dt id='avS1z'><q id='avS1z'><span id='avS1z'><b id='avS1z'><form id='avS1z'><ins id='avS1z'></ins><ul id='avS1z'></ul><sub id='avS1z'></sub></form><legend id='avS1z'></legend><bdo id='avS1z'><pre id='avS1z'><center id='avS1z'></center></pre></bdo></b><th id='avS1z'></th></span></q></dt></tr></i><div id='avS1z'><tfoot id='avS1z'></tfoot><dl id='avS1z'><fieldset id='avS1z'></fieldset></dl></div>

      JAVA_HOME 和 PATH 已设置,但 java -version 仍显示旧版本

      时间:2023-07-14

      • <bdo id='UTSYT'></bdo><ul id='UTSYT'></ul>
          <tbody id='UTSYT'></tbody>
      • <small id='UTSYT'></small><noframes id='UTSYT'>

          <tfoot id='UTSYT'></tfoot>

              <i id='UTSYT'><tr id='UTSYT'><dt id='UTSYT'><q id='UTSYT'><span id='UTSYT'><b id='UTSYT'><form id='UTSYT'><ins id='UTSYT'></ins><ul id='UTSYT'></ul><sub id='UTSYT'></sub></form><legend id='UTSYT'></legend><bdo id='UTSYT'><pre id='UTSYT'><center id='UTSYT'></center></pre></bdo></b><th id='UTSYT'></th></span></q></dt></tr></i><div id='UTSYT'><tfoot id='UTSYT'></tfoot><dl id='UTSYT'><fieldset id='UTSYT'></fieldset></dl></div>

              1. <legend id='UTSYT'><style id='UTSYT'><dir id='UTSYT'><q id='UTSYT'></q></dir></style></legend>
              2. 本文介绍了JAVA_HOME 和 PATH 已设置,但 java -version 仍显示旧版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我正在使用 Linux Mint Cinnamon 14.我在 ~/.profile 中设置了 $JAVA_HOME$PATH 环境变量,如下所示:

                I am using Linux Mint Cinnamon 14. I have set the $JAVA_HOME and $PATH environment variables in ~/.profile as follows:

                export JAVA_HOME=/home/aqeel/development/jdk/jdk1.6.0_35
                export PATH=/home/aqeel/development/jdk/jdk1.6.0_35/bin:$PATH
                

                然后我做了 source ~/.profile 以进行适当的更改.

                I then did source ~/.profile to make the proper changes.

                当我执行 java -version 命令检查活动的 java 版本时,它显示默认的(已经安装的 open-jdk)java 版本.如何用我下载的 open-jdk 覆盖默认的 open-jdk?

                When I execute java -version command to check the active java version, it shows the default (already installed open-jdk) java version. How can I override the default open-jdk with the one I downloaded?

                更新:

                哪个java说/usr/bin/java

                which java says /usr/bin/java

                $JAVA_HOME/bin/java -version 说权限被拒绝"

                sudo $JAVA_HOME/bin/java -version(然后要求输入密码)说找不到命令

                sudo $JAVA_HOME/bin/java -version (asks for password, then) says Command not found

                但是cd $JAVA_HOME/bin,而ls显示是正确的目录.

                but cd $JAVA_HOME/bin, and ls shows that it is right directory.

                推荐答案

                虽然您的设置看起来是正确的,但有几件事需要检查:

                While it looks like your setup is correct, there are a few things to check:

                1. env 的输出 - 特别是 PATH.
                2. command -v java 告诉你什么?
                3. $JAVA_HOMEin 中是否有一个java 可执行文件,它是否设置了执行位?如果不是 chmod a+x java 它.
                1. The output of env - specifically PATH.
                2. command -v java tells you what?
                3. Is there a java executable in $JAVA_HOMEin and does it have the execute bit set? If not chmod a+x java it.

                我相信在添加/更改 JAVA_HOMEPATH 之后,您的 .profile 已经 source 了?

                I trust you have source'd your .profile after adding/changing the JAVA_HOME and PATH?

                另外,您可以通过编写以下代码来帮助自己在将来维护 JDK 安装:

                Also, you can help yourself in future maintenance of your JDK installation by writing this instead:

                export JAVA_HOME=/home/aqeel/development/jdk/jdk1.6.0_35
                export PATH=$JAVA_HOME/bin:$PATH
                

                那么你在安装JDK的时候只需要更新一个环境变量.

                Then you only need to update one env variable when you setup the JDK installation.

                最后,您可能需要运行 hash -r 来清除 Bash 程序缓存.其他 shell 可能需要类似的命令.

                Finally, you may need to run hash -r to clear the Bash program cache. Other shells may need a similar command.

                干杯,

                这篇关于JAVA_HOME 和 PATH 已设置,但 java -version 仍显示旧版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:如何通过环境变量设置 Java 的最小和最大堆大小? 下一篇:在 log4j xml 配置中使用系统环境变量

                相关文章

              3. <small id='ICH1g'></small><noframes id='ICH1g'>

                <tfoot id='ICH1g'></tfoot>
                <legend id='ICH1g'><style id='ICH1g'><dir id='ICH1g'><q id='ICH1g'></q></dir></style></legend>

                      <bdo id='ICH1g'></bdo><ul id='ICH1g'></ul>

                    <i id='ICH1g'><tr id='ICH1g'><dt id='ICH1g'><q id='ICH1g'><span id='ICH1g'><b id='ICH1g'><form id='ICH1g'><ins id='ICH1g'></ins><ul id='ICH1g'></ul><sub id='ICH1g'></sub></form><legend id='ICH1g'></legend><bdo id='ICH1g'><pre id='ICH1g'><center id='ICH1g'></center></pre></bdo></b><th id='ICH1g'></th></span></q></dt></tr></i><div id='ICH1g'><tfoot id='ICH1g'></tfoot><dl id='ICH1g'><fieldset id='ICH1g'></fieldset></dl></div>