I have a jetty 9 installed on CentOS in /srv/jetty
, and I have a webapp deployed inside jetty.
When I start jetty with java -jar start.jar &
then inside the web application I can do this:
File base = new File(".");
System.out.println("Base Dir: " + base.getAbsolutePath());
And it returns me the correct directory of the jetty installation.
But then I add jetty as a linux service, to run with a user called jetty, and start with service jetty start
then calling the above code, will allways give me back the home directory of the user, who is running jetty in this case /home/jetty/
or if I run as root then /root/
How can I set up jetty to find the correct directory? I tried with jetty.home in the config files, but nothing seems to work.