Running Railo from any directory

Posted by Mark Drew on code on September 11, 2012

Tagged under railo

Today on the Railo mailing list someone asked if there was a way to start railo from any directory and use that directory as the web root. A fair enough question and it got me intrigued.

So after a bit of research I come up with the following, of course this works for OS X, change the relevant bits to suit your OS (hey, send me how to do it and I shall update the post)

First off, I downloaded Railo Express ( and saved it to:


Then I copied the ./start and renamed it to ./railo_runner

I added the path to ~/.bash_profile by adding:

export RAILO_RUNNER=/Applications/railo_runner/ export PATH=$PATH:$RAILO_RUNNER

so now, to change the railo_runner script. Mine looks like this:

#!/bin/bash CURRPATH=$(pwd) cd $(dirname $0) java -DSTOP.PORT=8887 -DSTOP.KEY=railo -jar -Xms256M  -Xmx512M lib/start.jar -Drespath=$CURRPATH

The only thing I added was the current path and added it as a System property with the -D flag, as you can see by the -Drespath=$CURRPATH. All is good so far, now to tell Jetty to do something with it!

In the /Applications/railo_runner/contexts/railo.xml I changed the system property that is used for the resourceRoot:

<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "">   /       /etc/webdefault.xml

Now I can do the following: Earth:~ markdrew$ cd ~/Sites/ Earth:Sites markdrew$ mkdir demo_site1 Earth:Sites markdrew$ cd demo_site1 Earth:demo_site1 markdrew$ railo_runner

And voila! It creates the WEB-INF and you are good to go by http://localhost:8888!

comments powered by Disqus