Guide via someone’s request. Put here for a moment.

Demo App:

0. Download [demo blog application](http://7thgen.info/files/misc/rails_demo_app.zip).

JRuby:

1. Download [JRuby](http://jruby.org/download).
2. Unpack it to a folder which will be your `JRUBY_HOME`.
3. Add `JRUBY_HOME/bin` to your `PATH` environment variable.
4. Test JRuby:
`jruby -v`

Gems:

5. Test rubygems and install some gems:
`jruby -S gem list`
`jruby -S gem install rails mongrel jdbc-mysql activerecord-jdbcmysql-adapter`
6. Test Rails:
`jruby -S rails -v`
`jruby -S rails -d mysql blog`
7. Clean:
`rm -rf blog`

Running demo under JRuby:

8. Unpack demo app and go into the root folder.
9. Open `config/database.yml`, change all:
`adapter: mysql => adapter: jdbcmysql`
Also change `host/socket, database, username, password` via your environment.
NOTE: Prepare the MySQL user and database if needed.

10. Create DB schema:
`jruby -S rake db:migrate`

11. Start server:
`jruby script/server`

12. Now you can test the demo app within this full Java environment.
Go to [http://localhost:3000](http://localhost:3000) and check the environment.

Debugging under JRuby

13. Download newest [jruby-debug-base](http://rubyforge.org/frs/?group_id=3085)
(The file: `ruby-debug-base-0.10.3.1-java.gem`)

14. Install `jruby-debug-base` and `ruby-debug`:
`jruby -S gem install ruby-debug-base-0.10.3.1-java.gem`
`jruby -S gem install –ignore-dependencies ruby-debug`

15. Now you can start server under debugging mode:
`jruby script/server –debugger`

Deploy to Tomcat

16. Install Warbler:
`jruby -S gem install warbler`

17. Go to demo app folder, run:
`jruby -S warble pluginize`

18. Check all rake task that warble add to your app, run:
`jruby -S warble -T`

19. Create a Warbler config file under `config` folder:
`jruby -S warble config`

20. Open `config/warble.rb`, uncomment the following line:
` config.gems += [“activerecord-jdbcmysql-adapter”, “jruby-openssl”]`

21. Run Warbler to generate WAR bundle:
`jruby -S warble`

22. (Optional) Clean the temporary files:
`rm -rf tmp/war`

23. Find WAR bundle under app root and copy it to Tomcat’s webapps folder.

24. Warbler generates WAR using production mode, so remember to:
– create `blog_production` database;
– make sure that user `demo` has full access to it;
– then in the demo app folder run:
`jruby -S rake db:migrate RAILS_ENV=production`

25. Start Tomcat server and navigate to [http://localhost:8080/blog/posts](http://localhost:8080/blog/posts).

More:

26. Read more on [JRuby & Java Interoperation](http://kenai.com/projects/jruby/pages/FAQs#Java_and_JRuby_Interoperation)