简体   繁体   中英

C:\Program Files\Java\jdk1.8.0_131\javac.exe"' is not recognized as an internal or external command

Thanks very much for your help. So here is what I'm trying to do:

I am trying to use Jenkins for the first time, but every time a build is run it gives me an error that reads:

[ERROR] Failure executing javac, but could not parse the error: [ERROR] '"C:\Program Files\Java\jdk1.8.0_131\javac.exe"' is not recognized as an internal or external command.

It's looking for javac.exe in the wrong folder as it's actually inside C:\\Program Files\\Java\\jdk1.8.0_131\\bin\\javac.exe (Inside the bin folder)

在此处输入图片说明

Every tutorial I read on the internet asks me to do this set up inside the System Variables and I think I've done every single combination of those. (I know there's plenty of SO questions similar to these one but unfortunately I haven't been able to fix my issue using their solution). That's what I have at the moment:

在此处输入图片说明

System Variables 在此处输入图片说明

User Variables 在此处输入图片说明

在此处输入图片说明

在此处输入图片说明

If anyone could please point out what I'm doing wrong that would be really very much appreciated. Thanks a lot!! :)

I don't see a lot of variables there. Are those your system or user environment variables? Use the system environment variables.

  • Check your java path (go to "C:\\Program Files\\Java\\jdk1.7.0_02" and copy the address).
  • Go to your System Environment Variables and create a new one called JAVA_HOME.
  • Insert "%JAVA_HOME%\\bin" at the beginning of the Path variable followed by semicolon
  • Close and reopen your command prompt

将其添加到环境变量中,并在JDK bin位于PATH中的位置添加链接

I think I found what was causing the problem. This line on the project POM was the one with the wrong JDK path:

在此处输入图片说明

Thanks for the help anyways. :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM