Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running Java Jar via Jenkins

Tags:

java

jar

jenkins

I have a Java jar file which takes two csv files as an input. I tried to run this jar via Linux command line and it works fine.

Here is what i tried on Linux command line:

java -jar /home/test/Download.jar

I am trying to do the same via Jenkins in Execute shell but I am getting error:

Couldn't load file: test1.csv
Couldn't load file: test2.csv
information possible empty

These are the csv files that Jar takes as input.

I have given chmod 777 permission to all files.

like image 215
Developer Avatar asked Feb 02 '26 13:02

Developer


1 Answers

Probably that's because of the location of the test[12].csv files. Try printing out the getAbsolutePath() for those File entries that you want to load: I'm sure they will point to a non-existing location.

I suppose those files are "next to" your Download.jar file. Now when you're executing a Jenkins job, the actual working directory is the workspace of the job (check the console log of the job on the web interface for the details). Either copy the files there or use absolute references.

like image 110
rlegendi Avatar answered Feb 05 '26 04:02

rlegendi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!