When I run a jar file, say in /home/jars like such java -jar /home/jars/jarfile.jar, it seems to run in whatever directory I'm in.
How do I make it so java -jar /home/jars/jarfile.jar runs with /home/jars as the current working directory??
When I run a jar file, say in /home/jars like such java -jar /home/jars/jarfile.jar, it seems to run in whatever directory I'm in.
How do I make it so java -jar /home/jars/jarfile.jar runs with /home/jars as the current working directory??
The simple answer:
( cd /home/jars; java -jar /home/jars/jarfile.jar )
The analogy for most languages supporting an exec call, is the variant of exec that lets you specify a working directory.