Reputation: 91629
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??
Upvotes: 0
Views: 141
Reputation: 8463
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.
See this for simple PHP solution.
Upvotes: 4