【问题解决】Vscode报错 Error:Could not create the Java Virtual Machine

问题:

进入配置工程时,出现以下错误:
Error:Could not create the Java Virtual Machine
【问题解决】Vscode报错 Error:Could not create the Java Virtual Machine_第1张图片

原因:

JAVA环境变量未配置好

解决:

在“此电脑 > 属性 > 高级系统设置 > 高级 > 环境变量 >系统变量”中,新增变量:
变量名:JAVA_HOME
变量值:D:\Professional_Software\Java\jdk1.8.0_221 (根据自己的JAVA实际路径填写)
【问题解决】Vscode报错 Error:Could not create the Java Virtual Machine_第2张图片

在 PATH 变量下面添加以下两个变量值:

  • %JAVA_HOME%\bin
  • %JAVA_HOME%\lib\tools.jar
    【问题解决】Vscode报错 Error:Could not create the Java Virtual Machine_第3张图片
    两个变量移动到所有JAVA变量的上面,注意不要移动要第一条,否则无法显示界面框。
    【问题解决】Vscode报错 Error:Could not create the Java Virtual Machine_第4张图片
    重启一下电脑使环境变量生效就可以了。



    另外一种方法无效:(记录)
    【问题解决】Vscode报错 Error:Could not create the Java Virtual Machine_第5张图片
    【问题解决】Vscode报错 Error:Could not create the Java Virtual Machine_第6张图片
    参考:
    https://zhidao.baidu.com/question/240121483078990484.html
    https://blog.csdn.net/weixin_37601546/article/details/88623530
    https://blog.csdn.net/denglianqing99/article/details/82382262
    https://blog.csdn.net/eacxzm/article/details/81045213
    https://blog.csdn.net/zp357252539/article/details/52278882

你可能感兴趣的:(HarmonyOS,java,vscode,开发语言)