Jenkins | "The system cannot find the file specified" Jenkins | "The system cannot find the file specified" jenkins jenkins

Jenkins | "The system cannot find the file specified"


identify the current dir path where .bat file is placed and append / add to system path variable. Once done then allow jenkin to execute .bat file.


This is an issue with your working directory being different when you're running on Jenkins.

Easiest fix:Execute Windows Batch Command instead for your build step. On the first line, put cd C:/Desktop/QA/ to change your working directory to match what you're doing locally. On your second line use trigger.bat or C:\Desktop\QA\trigger.bat.

More robust fix:In your java code, you're using .\ when referencing other files. This basically means current directory, which won't be what you want if you're in a different working directory. Instead, you can look at this question/answer which shows how to reference the directory where your .jar file is instead of the working directory. In summary do this:

return new File(MyClass.class.getProtectionDomain().getCodeSource()    .getLocation().toURI().getPath());


The problem was with the installation of Jenkins. A devops engineer solved this for me. Had to install Tomcat and jenkins within that. He said "If Jenkins is installed as UI, it can't open another UI. Hence we should install .war file on a separate server which creates separate UI for jenkins, and my application UI (firefox) can be launched on the local".