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

      • <bdo id='ph04H'></bdo><ul id='ph04H'></ul>

      <legend id='ph04H'><style id='ph04H'><dir id='ph04H'><q id='ph04H'></q></dir></style></legend>

    1. <tfoot id='ph04H'></tfoot>
      1. <small id='ph04H'></small><noframes id='ph04H'>

        适用于 Linux 的 Windows 子系统无法识别 JAVA_HOME 环境变量

        Windows Subsystem for Linux not recognizing JAVA_HOME Environmental Variable(适用于 Linux 的 Windows 子系统无法识别 JAVA_HOME 环境变量)

              <small id='oDep5'></small><noframes id='oDep5'>

              <legend id='oDep5'><style id='oDep5'><dir id='oDep5'><q id='oDep5'></q></dir></style></legend>
                  <bdo id='oDep5'></bdo><ul id='oDep5'></ul>
                • <tfoot id='oDep5'></tfoot>

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

                    <tbody id='oDep5'></tbody>
                  本文介绍了适用于 Linux 的 Windows 子系统无法识别 JAVA_HOME 环境变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我试图让 WSL 识别我的 Windows 安装的 JAVA_HOME 环境变量.我附上了我的 bashrc 中的内容和我的 windows 环境变量中的内容以及 cmd 和 bash 的输出.

                  I'm trying to get WSL to recognize my windows installed environmental variable of JAVA_HOME. I attached of what I have in my bashrc and what I have in my windows environmental variables along with outputs from cmd and bash.

                  我的 bashrc 末尾是什么:

                  What's at the end of my bashrc:

                  export JAVA_HOME="/mnt/d/Program Files/Java/jdk-11.0.1"
                  export PATH="/mnt/d/Program Files/Java/jdk-11.0.1/bin:$PATH"
                  

                  CMD 输入/输出:

                  C:Usersjaall>javac --version
                  javac 11.0.1
                  

                  BASH 输入/输出:

                  BASH INPUT/OUTPUT:

                  myubuntu_name@DESKTOP-LUK3BII:~$ javac --version
                  
                  Command 'javac' not found, but can be installed with:
                  
                  sudo apt install default-jdk
                  sudo apt install openjdk-11-jdk-headless
                  sudo apt install ecj
                  sudo apt install openjdk-8-jdk-headless
                  

                  我已经被这个问题困扰了一段时间,无法弄清楚或在线找到有效的解决方案.谢谢!

                  I've been stuck on this for awhile and can't figure it out or find a working solution online. Thanks!

                  推荐答案

                  正如 Biswapriyo 所建议的,您应该使用 WSLENV.

                  As Biswapriyo suggested, you should use WSLENV.

                  1. 打开 PowerShell.然后将 JAVA_HOME 设置为您的 java 安装路径.

                  1. Open PowerShell. Then set JAVA_HOME to the path to your java installation.

                  在你的情况下,运行 setx JAVA_HOME "D:Program FilesJavajdk-11.0.1"

                  您应该会看到一条消息成功:指定的值已保存.

                  You should see a message that says "SUCCESS: Specified value was saved.

                  1. 然后运行 setx WSLENV "JAVA_HOME/p"

                  您应该会再次看到成功消息.

                  You should see the success message again.

                  1. 在 WSL bash 提示符中输入env".

                  此时您应该会看到 JAVA_HOME 设置正确.

                  You should see JAVA_HOME correctly set at this point.

                  注意:如果第 2 步不起作用,您可能需要更改 JAVA_HOME 的路径以包含in"文件夹.

                  Note: If step 2 doesn't work, you might want to changing the path to JAVA_HOME to include the 'in' folder.

                  这篇关于适用于 Linux 的 Windows 子系统无法识别 JAVA_HOME 环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Maven JAVA_HOME environment variable is not defined correctly, but it is(Maven JAVA_HOME 环境变量未正确定义,但它是)
                  Java System Environment Variable(Java 系统环境变量)
                  Java -classpath option(Java -classpath 选项)
                  Read environment variable in SpringBoot(在 SpringBoot 中读取环境变量)
                  Tomcat 8 - context.xml use Environment Variable in Datasource(Tomcat 8 - context.xml 在数据源中使用环境变量)
                  Issue with JAVA_HOME(JAVA_HOME 的问题)
                    • <legend id='3dqH6'><style id='3dqH6'><dir id='3dqH6'><q id='3dqH6'></q></dir></style></legend>
                        <i id='3dqH6'><tr id='3dqH6'><dt id='3dqH6'><q id='3dqH6'><span id='3dqH6'><b id='3dqH6'><form id='3dqH6'><ins id='3dqH6'></ins><ul id='3dqH6'></ul><sub id='3dqH6'></sub></form><legend id='3dqH6'></legend><bdo id='3dqH6'><pre id='3dqH6'><center id='3dqH6'></center></pre></bdo></b><th id='3dqH6'></th></span></q></dt></tr></i><div id='3dqH6'><tfoot id='3dqH6'></tfoot><dl id='3dqH6'><fieldset id='3dqH6'></fieldset></dl></div>

                          <tbody id='3dqH6'></tbody>

                          <bdo id='3dqH6'></bdo><ul id='3dqH6'></ul>

                            <tfoot id='3dqH6'></tfoot>

                            <small id='3dqH6'></small><noframes id='3dqH6'>