Developer
Developer

Reputation: 837

Running Java Jar via 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.

Upvotes: 3

Views: 7394

Answers (1)

rlegendi
rlegendi

Reputation: 10606

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.

Upvotes: 1

Related Questions