无法在VS Code上运行Tomcat服务器。

huangapple go评论153阅读模式
英文:

Can't run Tomcat Server on VS code

问题

我无法在VS Code上运行Tomcat服务器。

错误消息如下所示:

[apache-tomcat-9.0.37]:'C:\Program'不被视为内部或外部命令,可操作的程序或批处理文件。

然而,我的Tomcat文件夹放在D盘,与源代码放在同一个文件夹中。
我不知道为什么它在尝试搜索“C:\Program”文件夹。
如果您能帮忙解决,我将不胜感激。
谢谢

jdk1.8
Windows10
VS code1.47.2
Tomcat9.0.37

英文:

I can't run Tomcat server on VS code.

The error message says below

[apache-tomcat-9.0.37]: 'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

However my tomcat folder is put on D drive, same folder as source code.
I don't know why it's trying to search "C:\Program" folder.
I really appreciate it if you could help.
Thank you

jdk1.8
Windows10
VS code1.47.2
Tomcat9.0.37

enter image description here

答案1

得分: 5

我猜这在插件的最新版本中出现了问题。我遇到了类似的问题。现在我正在回退到一个两个月前的插件版本。这似乎可以工作。我很惊讶VS.Code会自动升级插件。

英文:

I guess this is broken in latest build of Plug In . I faced similar issue .Now I am reverting back to a plug in version which is 2 months old . This seems to work.
I was surprised that VS.Code automatically upgrades the plug in.

答案2

得分: 4

在我的这一方面,我发现这个扩展在启动之前会查找你的 settings.json 中指定的 "java.home" 路径,因此,注释掉该路径,错误就会解决。

英文:

On my side, I found that this extension looks your "java.home" path specified in your settings.json before it start, so commenting out the path and the error shall be solved.

答案3

得分: 2

我今天拿到了这个并且用以下方式'修复'了它:

C:\Progra~1\AdoptOpenJDK\jdk-11.0.7.10-hotspot\

对于Progra~1,我只是省略了空格,这已经足够让事情正常运行。

英文:

I got this today and I 'fixed' it with

C:\\Progra~1\\AdoptOpenJDK\\jdk-11.0.7.10-hotspot\\

With Progra~1 I just omitted the whitespace, which was enough to get things running.

答案4

得分: 0

我在设置动态网页应用程序的VS Code时也遇到了相同的问题,我发现我们可以通过从VS Code的settings.json中删除Java.home变量来解决这个问题。你可以通过ctrl+shift+p搜索settings.json来找到它。在你移除Java.home变量后,VS Code将从环境变量中搜索默认的JAVA_HOME变量,并运行Tomcat服务器。settings.json

我已经从设置中移除了JAVA_HOME,对我有效如此

英文:

I have also faced the same issue while setting up VS Code for a dynamic web app and I found that we can solve this issue by removing Java.home variable from VS Code settings.json. you can find it by ctrl+shift+p and search for settings.json. After you remove Java.home variable, VS Code will search for default JAVA_HOME variable from environment variables and it runs Tomcat server. settings.json

I have removed JAVA_HOME from settings and it's working for me like this.

答案5

得分: -2

  1. 安装Java扩展包

  2. setting.json

    "java.home" : "C:\\Program Files\\Java\\jdk1.8.0_261"
    
     更改为 "java.home" : "C:\\Java\\jdk1.8.0_261"
    
英文:
  1. install Java extenstion pack

  2. In setting.json

    "java.home" : "C:\\Program Files\\Java\\jdk1.8.0_261"
    
     change to "java.home" : "C:\\Java\\jdk1.8.0_261"
    

huangapple
  • 本文由 发表于 2020年7月21日 19:32:24
  • 转载请务必保留本文链接:https://go.coder-hub.com/63013587.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定