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 (3.3.4.003) and saved it to:
/Applications/railo_runner
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:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd"><Configure class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="contextPath">/</Set>
<!--
<Set name="resourceBase"><SystemProperty name="jetty.home" default="."/>/webroot/</Set>
-->
<Set name="resourceBase"><SystemProperty name="respath" default="./webroot/"/></Set>
<Set name="defaultsDescriptor"><SystemProperty name="jetty.home" default="."/>/etc/webdefault.xml</Set>
</Configure>
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!





#1 by Matt Levine - September 11, 2012 at 4:11 PM
#2 by Mark Drew - September 11, 2012 at 4:56 PM
#3 by Joshua F. Rountree - September 12, 2012 at 10:00 AM
FYI - here are the instructions written for Windows 7 that I constructed last night.
http://www.joshuairl.com/blog/2012/09/12/running-railo-from-any-directory-in-windows-7/
#4 by Mark Drew - September 12, 2012 at 10:27 AM
Also see the update I added so that you don't have to hard code the railo installation path.
#5 by tony petruzzi - September 17, 2012 at 4:17 PM
#6 by Joshua Rountree - March 21, 2013 at 2:49 PM
#7 by Peter Bowater - April 25, 2013 at 11:45 AM
java -DSTOP.PORT=8887 -DSTOP.KEY=railo -jar -Xms256M -Xmx512M start.jar -Drespath=$CURRPATH