I’m packaging this Java/Ant app https://github.com/NixOS/nixpkgs/pull/163400. Built files go into
$out/opt, with a java wrapper created in
$out/bin. However, the app has files in
$out/opt which it expects to run some non-jar files (seemingly XML files) in
$out/opt so that it runs. So running the wrapper in bin errors. It only works if I put the wrapper in opt, cd into that directory, and run from that directory, i.e. Java package guidelines - ArchWiki
Other files necessary to run the program are usually stored in the same folder as the main jar file, or a subdirectory thereof. Since Java programs do not know where their classes were loaded from, they usually need to be run from within this directory (i.e. the shell script should
cdinto the directory), or an environment variable is set to indicate the directory’s location.
How is this dealt with in nixpkgs? Is there an environment variable?
More info to reproduce the issue at com.osrmt.appclient.system.ConnectionXmlNotFoundException · Issue #59 · osrmt/osrmt · GitHub