I have a jar file that I want to launch from a bash script. This jar includes references to an external folder that contains images.
When I am running the jar from command line with the absolute path to the jar, all works OK. The problem appears when I run it from a bash script. Apparently the folder that contains the images is not found.
Launching from command line:
java -Djava.library.path=/opt/opencv/build/lib -Xmx1g -jar /home/version4/Podo.jar
Bash script:
#! /bin/bash -x
cmd="java -Djava.library.path=/opt/opencv/build/lib -Xmx1g -jar /home/version4/Podo.jar"
eval $cmd
The directory where are my images are is: /home/version4/img
The Java code for accesing the images:
String img_header="./img/HEADER.png";
String img_body="./img/BODY.png";
BufferedImage header,body;
header=ImageIO.read(new File(img_header));
body=ImageIO.read(new File(img_body));
The output error:
javax.imageio.IIOException: Can't read input file!
at javax.imageio.ImageIO.read(ImageIO.java:1301)
Can anyone tell me what I am doing wrong? Thank you.