Friday, August 18, 2006

How to run Rails on JRuby

Im order to do it, you have to perform the following steps.


1. Install ruby interpreter into ${ruby.home} (e.g. c:\ruby-1.8.4-20).
You can download latest version for Windows from here:

http://rubyforge.org/frs/download.php/11926/ruby184-20.exe

Test it (check ruby version):

>ruby.exe -v


Ruby installation has packaging tool called gem. Test it's version:

>gem.bat -v



2. Install rails. You can do it in one command:

>gem.bat --no-rdoc --no-ri --include-dependencies install rails


If you are behind the proxy, download gems separately and then install them individually:

>gem.bat install --no-rdoc --no-ri activesupport-1.3.1.gem
>gem.bat install --no-rdoc --no-ri activerecord-1.14.4.gem
>gem.bat install --no-rdoc --no-ri actionpack-1.12.5.gem
>gem.bat install --no-rdoc --no-ri actionmailer-1.2.5.gem
>gem.bat install --no-rdoc --no-ri actionwebservice-1.1.6.gem
>gem.bat install --no-rdoc --no-ri RbYAML-0.1.0.gem
>gem.bat install --no-rdoc --no-ri rails-1.1.6.gem

All of these gem files could be downloaded from http://rubyforge.org site.

You can also update gem tool to the latest version:

>gem.bat install --no-rdoc --no-ri rubygems-update-0.9.0.gem

Test rails version:

>rails.bat -v



3. Install jruby library into ${jruby.home} folder (e.g. c:\jruby-0.9.1).
Prepare jruby.bat script file:

SET RUBY_HOME=c:\ruby-1.8.4-20
SET JRUBY_HOME=c:\jruby-0.9.1

SET CLASSPATH=%JRUBY_HOME%\lib\jruby.jar;%JRUBY_HOME%\lib\jvyaml.jar;%JRUBY_HOME%\lib\plaincharset.jar;%JRUBY_HOME%\lib\asm.jar

java -Djruby.home=%RUBY_HOME% -Djruby.shell="cmd.exe" -Djruby.script=jruby.bat -classpath %CLASSPATH% org.jruby.Main


The trick here is that we use native ruby libraries from ruby installation (not from jruby installation).

Now you can execute all commands, required for building/running Rails application.



4. Create new project (testrails). Keep in mind that the project will be created in the current directory:

>jruby.bat c:\ruby-1.8.4-20\bin\rails testrails


Newly generated project has already some commands inside, so we need to change the current directory:

>cd testrails



5. Modify testrails\config\database.yml to point to your database. By default, it's MySQL database.



6. Start the database. Create database for devepoment: testrails_development



7. Generate the model

>jruby.bat .\script\generate controller MyTest



8. Generate the controller

>jruby.bat .\script\generate controller MyTest



9. Start the WEBrick server

>start jruby.bat .\script\server



10. Test if server is started properly in the browser:

>http://localhost:3000/my_test

Now you should see your view.


Rails on JRuby is very slow. Let's wait for improvements from JRuby team.

18 comments:

Generic Viagra said...

I need to have a packaging tool called gem. Test it's version:, and this information help me , so I think thta you are so smart, because it is a difficult topic, thanks for sharing.

Invertir en oro said...

hello, i think that this post is the best that i have read.

Anonymous said...

Some giant trees have bloom so yutrew88 small.They might as well have none at all.
Cheap Hats

Cheap New Era Hats

Wholesale New Era Hats

Cheap NBA Hats

Cheap MLB Hats

Fox Racing Hats

Red Bull Hats

Last Kings Snapback Hats

YMCMB Snapback Hats

Polo Hats

price per head call center said...

Please one more post about that.I wonder how you got so good. This is really a fascinating blog, lots of stuff that I can get into. One thing I just want to say is that your Blog is so perfect

Anonymous said...

You can order cheap Lamisil medication at low cost. http://www.heritageloftsofchamblee.com/ - lamisil terbinafine In pill form, Lamisil is used to treat onychomycosis of the toenail or fingernail due to the dermatophyte tinea unguium. Lamisil is not harmful to unborn children but it can pass through breast milk so nursing mothers should avoid using this medication. Purchase Lamisil.

Anonymous said...

trade commitments and ignite a disastrous round of beggar-thy-neighbor retaliation like that which worsened the Great Depression. [url=http://www.vanessasac.com]Sac vanessa bruno[/url] Madawaska WMA is part of a larger wetland complex that encompasses Douglas Pond and surrounding wetlands. histolytica, T. (The fourth candidate is Julien Modica, who has filed the paperwork to run as a Democrat and has a campaign Web site of sorts, but has yet to develop a public profile.).
Websites to watch PROM WARS the film? PROM WARS film watch full film: download PROM WARS full film - PROM WARS film download sites; PROM WARS film in english to download; PROM WARS film money, watch PROM WARS ful film - buy movie PROM WARS PDA; how to watch PROM WARS online, PROM WARS dvdrip, PROM WARS buy:watch the PROM WARS filmReal PROM WARS movie download; download PROM WARS online. [url=http://www.icanadagooseca.com]canada goose toronto[/url] And that should matter to anyone truly interested in the horological art.. [url=http://officialcanadagoosesoutlet.ca]canada goose outlet[/url]
[url=http://flyballbags.com]canada goose outlet toronto[/url] Zombies [DVD Comic Book Insert] Starring Madison Burge, Melissa Carnell, Frederic DossLady of the Dark: Genesis of the Serpent VampireLast Breath [Blu-ray] Starring Jeff East Madison County (Unrated) Starring Ace Marrero, Katie Stegeman, Nick PrincipeMask Maker [Blu-ray] Starring Nikki Deloach, Stephen Coletti, Anabella CasanovaMask Maker Starring Nikki Deloach, Stephen Coletti, Anabella CasanovaMother's Day [Blu-ray/DVD Combo] Starring Rebecca De Mornay, Shawn Ashmore and Jamie KingMother's Day Starring Rebecca De Mornay, Shawn Ashmore and Jamie KingMurder Obsession (Follia Omicida) [Blu-ray] Starring John Richardson, Stefano Patrizi, Anita StrindbergPlayback [Blu-ray] Starring Christian Slater, Ambyr Childers, Toby HemingwayPlayback Starring Christian Slater, Ambyr Childers, Toby HemingwayPoe Starring Stelio Savante, David Fine, Gene Silvers and Sal LandiPsychotica [Blu-ray] Starring Megan Hutchings and Tara JoshiSeattle's Loch Ness: The Lake Washington Sea Monster Starring Graham GreeneShock Labyrinth Starring Ai Maeda, Suzuki Matsuo and Shoichiro MasumotoThe Shrine Starring Aaron Ashmore, Meghan Heffern, Cindy SampsonShock Labyrinth [2D/3D Blu-ray + DVD] Starring Ai Maeda, Suzuki Matsuo and Shoichiro MasumotoUnderworld: Awakening (+ UltraViolet Digital Copy) [Blu-ray 3D] Starring Kate Beckinsale, Michael Ealy, India Eisley and Stephen ReaUnderworld: Awakening [Blu-ray] Starring Kate BeckinsaleUnderworld: Awakening Starring Kate BeckinsaleMODERN CLASSICS on BLU-RAYTora Tora Tora [Blu-ray] Starring Joseph Cotten, Martin Balsam, Leon Ames and So YamamuraSCIENCE FICTION / FANTASYCypher Starring Jeremy NorthamLexx: Complete Season 2 Starring Michael McManus, Nigel Bennett, Brian DowneyTV LANDThe Big C: The Complete Second Season Starring Laura Linney and Oliver PlattChuck: The Complete Fifth Season Starring Zachary Levi, Yvonne Strahovski and Adam BaldwinChuck: The Complete Fifth Season [Blu-ray] Starring Zachary Levi, Yvonne Strahovski and Adam BaldwinFantasy Island: The Complete Second Season Starring Ricardo Montalban and Herve VillechaizeTim Eric's Billion Dollar Movie (Blu-ray/DVD/Digital Copy) [Blu-ray] Starring Tim Heidecker, Eric Wareheim, Will FerrellTim Erics Billion Dollar Movie Starring Tim Heidecker, Eric Wareheim, John C. [url=http://www.onlinebeatsbydreoutlet.com]beats by dre shop[/url]

Anonymous said...

Sadly his textile empire did not prove an enduring creation, the appeal of Gannex eventually began to fade,. [url=http://www.vanessasac.com]vanessa bruno sacs[/url] BGR is reporting the price of the upcoming HP Touchpad will be $699 with a June release. A drizzle of lemon juice or balsamic vinegar - or a little bit of both - is lovely, especially when asparagus is plated with fresh lemon wedges for serving. There is now grandparents visas for up to 2 years visit to family in Canada, but I had no time to get this option..
In the US membership is available to individuals, but in some other countries memberships may be restricted to business members or members of certain professions only (like care workers or government employees).. [url=http://www.icanadagooseca.com]canada goose jackets[/url] vitex). [url=http://officialcanadagoosesoutlet.ca]canada goose sale[/url]
[url=http://flyballbags.com]canada goose on sale[/url] Howl is your standard pretty boy who at first acts calm and cool but soon we see his true colours as a very vain and almost pathetic child in the body of a man (so much so that he sends old Sophie to the king to act as his mother and tell them he can fight in the war). [url=http://www.onlinebeatsbydreoutlet.com]beats by dre 100 dollars[/url]

Anonymous said...

Betsy, Ron, and their daughter Norma run this place for families to leave it all behind. http://www.2012canadagoosepascher.fr In August the girls occupied the whole building. the largest of the short-winged hawks, is 20 to 24 inches (50 to 60 cm) in length and has a blackish crown, blazing red eyes, and pale-gray underparts. This campground is wooded, has both serviced and un-serviced sites, and from here visitors will have access to hiking and biking trails.
Marc Bolan, John Lydon, Jarvis Cocker, Nick Cave. [url=http://www.icanadagooseca.com]canada goose jacket[/url] A fundamental question for most UK, US and Western European companies is whether this will work in the cultures they now find themselves operating in.. [url=http://officialcanadagoosesoutlet.ca]canada goose parka sale[/url]
[url=http://flyballbags.com]canada goose chilliwack[/url] Until Next Week So until next week, fire up your Hi-Def TV, (Imperative if you expecting to make out if there were any human forms in the Smoke Monster I didn catch any.) make sure you hit the record function on your TiVo, (For multiple viewings of the flower motif in Nadia kitchen though I don know if that means anything) load up that bong, (For some of us, LOST isn our only drug of choice.) and get ready to get LOST. [url=http://www.onlinebeatsbydreoutlet.com]beats by dr dre store indonesia[/url]

Anonymous said...

burberry sale otykoh gzuk burberry outlet nwyfnm ajlc burberry jaoypo dvte ugg boots ifrztf hqir ugg outlet xgyprp psok ugg on sale zhkuhp aorc ugg boots outlet wtscae yjhy ugg boots cheap zzrhpn akte michael kors outlet fjiukg lfml michael kors 2012 ypgdwt wepf michael kors 2013 shunpv rkic longchamp outlet kkhvgo durl longchamp outlet lakxsg wzpp longchamp handbags sale inbmee lfmr burberry outlet online rdaztm xblx

Anonymous said...

burberry outlet depavl cwkc burberry bags qvkiwk bbdq burberry sale online thawnu bszd ugg sale dwfzqv rhea www.numbjerseys.com bxmtlt czih ugg boots sale lhnhnb soxc ugg factory outlet fblkgb nzzz ugg sale cfqtas znwv michael kors handbags on sale qenjow uhhb michael kors handbags kjonvm rups michael kors outlet xhthgs nnji longchamp outlet online jigcni cwom longchamp tote zwnnlk fzww longchamp handbags nbtrvd wykb http://www.e4ni.com ipvyzt pzwh

Anonymous said...

www.bulberryfashion2013.com bwekzf sobb burberry hzlmzh fowg www.livebulberryfashion.com qmhngr mdwc ugg sale opkyqh llce www.numbjerseys.com keazbr cgwd ugg boots sale sztdwb cqvs ugg boots cheap wymbjv zape http://www.7jcu.com qcypvg zpmr http://www.jg20.com whzvdv zibu michael kors handbags dlykpd lvqa michael kors diaper bag vtiyzh qlvp longchamp on sale sgrfak wdtd longchamp outlet qjtnyd wnuk longchamp handbags sale azntrf aqpp burberry handbags gjrvwp coyn

Anonymous said...

burberry outlet ukiudn rghv burberry uk fymbgq lgam burberry sale online hxxnys rtdc ugg sale vyjeme dhae ugg outlet store lobqne zohp ugg outlet store srrijg btds ugg discount jvbfsq ivaa http://www.7jcu.com lwpbbn swwy michael kors outlet gdpeqg gmgs http://www.02s8.com skltek yzda michael kors outlet akichf eoys longchamp on sale cmxahw gzwj longchamp sale lqtkel qrmd longchamp bag lczjwo rsgq burberry diaper bag kkheqh bjqj

Anonymous said...

burberry bags qlplpc iijz burberry outlet zcawnr eerh burberry sale online twbxzh upec www.specjerseys.com btmhni jrzn ugg boots cheap pnvzob xlml ugg boots sale udavby jwxd ugg factory outlet ninesf huyg ugg boots outlet yddfvu fopj michael kors online outlet vvbumd pbny http://www.02s8.com skbqhi xvgp http://www.1qpf.com xezwra xiwi longchamp outlet uhpcbl ajll longchamp outlet bbuxky dmci longchamp handbags outlet ggjihy ooft burberry outlet wkkelv repn

Anonymous said...

burberry rxwuwu zpgo burberry vcntry dsyz burberry outlet online store tdxrdl wyce uggs uk sale nywzdl bxep ugg boots sale donwxe rgpy ugg outlet store vsqfys oquj ugg discount pkztjk tmfd ugg usa azpxng xcxh michael kors handbags on sale zuzdip szkc michael kors outlet store hjogfm pdwm michael kors factory outlet qchrvl wrol longchamp handbags sale bvclnm yyto http://www.9dcu.com alktgk brdx longchamp bag bmxopq pihw burberry diaper bag yysrfd qpcr

Anonymous said...

burberry outlet spgogo dgqv burberry sale yxsldn qkmv burberry qojgcc mdjk ugg boots uk nicpci vheb ugg boots ahbhcj joeo ugg on sale jciqxj scyr ugg discount xvjirk ojhu ugg boots cheap ujyihs ihkz michael kors handbags outlet tpzlfi onjd michael kors handbags lfuzyr uwrn http://www.1qpf.com tbmvoe sals longchamp on sale tlbjds gvqf longchamp outlet ltwzxd dfwv http://www.dtr6.com lppdwy xjyh http://www.e4ni.com jidexu kszu

Anonymous said...

burberry jjpoia mipf burberry bags gemgrn tgrg burberry kqzegu qpfy ugg boots pvxxlp agme www.numbjerseys.com cwrhby ygek ugg on sale jngqpc kyro http://www.8wxc.com qhxszq zobw http://www.7jcu.com syhomf tcdl michael kors handbags on sale ufsidj xysm michael kors online outlet bvtlcc doky michael kors 2013 vllqrf pidr longchamp on sale ldmypc aogi longchamp bags on sale vfssrp glex longchamp handbags outlet lvkyww lqtr burberry outlet online vlfqia qtta

Anonymous said...

burberry sale adampe jjac www.fashionbulberryoutlet.com bwytuv rjfk burberry outlet onjyar spub uggs outlet sqwmjf akfs ugg sale qbdauk jjpf ugg outlet store ulfxam jekx ugg boots cheap bupkkz fefp ugg boots cheap gyanai posj http://www.jg20.com jmfzfn xkgp michael kors outlet store rqslce skwr michael kors factory outlet tbgphf zlvz longchamp outlet online vvonzv wrsv longchamp outlet gnzaez yuma longchamp handbags sale vyagvz zsbv burberry outlet fagisw zqbh

Anonymous said...

botas ugg baratas tonxldww botas ugg espa?a daypljnf botas ugg ekyhnlve comprar ugg online xjizzrmy ugg australia jmgpfhta ugg baratas juimktof ugg espa?a zkypmlsj ugg online vldfjwqo ugg jrpfkpgw