vscode-tomcat icon indicating copy to clipboard operation
vscode-tomcat copied to clipboard

Spawn jar ENOENT error when try to debug/run on tomcat server

Open SummerSun opened this issue 7 years ago • 10 comments

Met this issue from the very beginning I use the extension.

jar command runs very well on any console in Windows 10. But when I tried to Debug a war on tomcat server, or run a war on tomcat server. It just failed with Error: Spawn jar ENONET.

Repro steps:

  1. Add jdk/bin to the very end of Path
  2. Launch VSCode with Tomcat Extension
  3. Find a .war file, right-click Run on tomcat server

Expected: Successfully run the war file on tomcat server.

Actual: Error: Spawn jar ENOENT. And nothing continue.

The issue may be external to VSCode or NodeJS, but also file an issue to track it here.

SummerSun avatar Jan 05 '18 02:01 SummerSun

I am experiencing the same issue on Windows 10. I am able to use the extension just fine with the same .war file when running Visual Studio on a Mac. For me it is only an issue on Windows 10

steve-thousand avatar Mar 25 '18 20:03 steve-thousand

@persecond

Sorry to hear this. I may forgot to mention the fix: just the find the jdk environment variables in path and move it to the beginning, like top 5-10 is also ok.

The issue is external for the extension or even for VSCode. So I created it and mark the external for tracking.

SummerSun avatar Mar 26 '18 01:03 SummerSun

I too working in windows 10 .

The issue got resolved . There should not be two path variable for system and user. If it is there, had the jdk/bin in both the path variable

gomahan avatar Apr 02 '18 18:04 gomahan

Hi,

I am having the same issue but in Ubuntu. I have moved the bin folder of my JDK installation to the beginning of my path variables but it still fails:

echo $PATH /opt/java-jdk/jdk1.8.0_181/bin:/home/...

Could you please give me some advice on how to solve this ?

Thank you !

trystan2k avatar Jul 18 '18 06:07 trystan2k

@trystan2k Hi, sorry the above solution does not work for Ubuntu.

SummerSun avatar Jul 18 '18 10:07 SummerSun

@trystan2k I'm also in ubuntu (openJDK 8) and do not have this issue. Can you type the following commands into your terminal $ which java

Additionally, how did you go about installing java? The traditional $ sudo apt install default-jdk or a different way?

Hi @JustAnotherSoftwareDeveloper , I am using Oracle JDK 8. So I installed following the guide on this page *https://www.digitalocean.com/community/tutorials/how-to-install-java-with-apt-on-ubuntu-18-04 - the part about Oracle JDK).

Could this be the problem, do you think ?

$ which java
/opt/java-jdk/jdk1.8.0_181/bin/java

Thanks !

trystan2k avatar Jul 20 '18 19:07 trystan2k

I'm betting it is, but most likely not because anything inherently wrong with oracle JDK, but just something weird. vscode-tomcat is simply calling the 'jar -xvf something.war' command on the backend.

I'm assuming you've already ran $ sudo update-alternatives --config jar ? If not, try keeping them at the same version

Additionally, would you mind trying switching back to openjdk-8 using the update-alternatives command and then trying to run tomcat? One idea I have is that there's a permission issue with one of the folders, and java pointing in the opt directory. If it works with openjdk-8 and not the oracle-JDK, it narrows the amount of things that could be wrong down quite a bit.

Hi @JustAnotherSoftwareDeveloper ,

I didn't have ran the update-alternatives and seems that this was the key. I ran it for jar, java, and javac and put all in the same value (in the first on, auto-mode) and it worked like a charm !!

Thanks a lot for your help!

trystan2k avatar Jul 21 '18 11:07 trystan2k

I ran into the same issue, windows 10. Adding java home to my user environment variables resolved the issue (previously I only listed java in the system environment variables)

ChekTek avatar Dec 03 '18 14:12 ChekTek