ShashankAC
ShashankAC

Reputation: 1078

Jenkins Build Failure, is this a Path variable issue?

I am new to Jenkins and currently doing a course on Udemy, I am working on Windows.

I am trying to build a sample project using the Maven plugin.

I am getting the following error in the console output after the build failure.

ERROR: Failed to parse POMs
java.io.IOException: Cannot run program " C:\Program Files\Java\jdk1.8.0_291/bin/java" (in directory "C:\Users\Shashank\AppData\Local\Jenkins\.jenkins\workspace\Time Tracker"): CreateProcess error=2, The system cannot find the file specified
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
    at hudson.Proc$LocalProc.<init>(Proc.java:252)
    at hudson.Proc$LocalProc.<init>(Proc.java:221)
    at hudson.Launcher$LocalLauncher.launch(Launcher.java:996)
    at hudson.Launcher$ProcStarter.start(Launcher.java:508)
    at hudson.maven.AbstractMavenProcessFactory.newProcess(AbstractMavenProcessFactory.java:280)
    at hudson.maven.ProcessCache.get(ProcessCache.java:236)
    at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:802)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:513)
    at hudson.model.Run.execute(Run.java:1906)
    at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:543)
    at hudson.model.ResourceController.execute(ResourceController.java:97)
    at hudson.model.Executor.run(Executor.java:429)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
    at java.lang.ProcessImpl.create(Native Method)
    at java.lang.ProcessImpl.<init>(ProcessImpl.java:453)
    at java.lang.ProcessImpl.start(ProcessImpl.java:140)
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
    ... 12 more
Finished: FAILURE

I noticed a sudden change from \ to / in here

Cannot run program " C:\Program Files\Java\jdk1.8.0_291/bin/java"

is that the issue ? Any help will be appreciated.

Below is a screenshot of the configuration enter image description here

Upvotes: 1

Views: 774

Answers (1)

Kemal Kaplan
Kemal Kaplan

Reputation: 1024

It can be due to the space at the beginning of the command.

try "C:\Program Files\Java\jdk1.8.0_291/bin/java" instead of " C:\Program Files\Java\jdk1.8.0_291/bin/java"

even " C:\Windows\explorer.exe" won't work with the preceding space character when it is used with quotation marks...

Upvotes: 1

Related Questions