Can't run Tomcat Server on VS code

Viewed 4758

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

5 Answers

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.

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.

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.

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.

  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"
    
Related