tags:

views:

915

answers:

2

Is there a variable where I can find out the root directory of my Grails application?

for example, I have a folder named "chart" under \%root%\web-app\images\ where I put my charts in. Once I deploy my grails application on Jetty, I will get FileNotFoundException because the root path becomes /srv/www/vhosts/domain-name/jetty-version/

I would like to know if there is a variable that returns the root path (like /srv/www/vhosts/domain-name/jetty-version/webapps/myapp), and there should be because CSS uses relative path just fine.

+3  A: 
System.properties['base.dir']
Sev
A: 

solved.

request.getSession().getServletContext().getRealPath("/")

this actually gives me the path to where my application puts the images, css, WEB-INF, etc. folders.

steve.yu
You might want to mark your answer as the accepted answer.
Chad Gorshing