April 20, 2014
Hot Topics:
RSS RSS feed Download our iPhone app

Running Your First Rails Application on JRuby, Page 2

  • February 26, 2007
  • By Dominic Da Silva
  • Send Email »
  • More Articles »

Change to the 'myfirstjrorapp' directory and run the command 'jruby scriptserver'. This will start the Rails built-in 'WEBrick' web server and start your application on port 3000:



Click here for a larger image.

If you get an error such as the following:



Click here for a larger image.

It means that your Ruby on Rails installation is older than the JRuby on Rails installation and therefore the 'myfirstjrorapp' is looking for the older Ruby on Rails version. In your case, the Ruby on Rails version is 1.2.1, but the JRuby on Rails version is 1.2.2. To fix this, edit the 'myfirstjrorappconfigenvironment.rb' file and update the RAILS_GEM_VERSION variable:

# Specifies gem version of Rails to use when vendor/rails is not present

RAILS_GEM_VERSION = '1.2.2' unless defined? RAILS_GEM_VERSION

Now, you can point your browser to http://localhost:3000/. you should see the following:



Click here for a larger image.

That is it. You have created your first JRuby on Rails application!

Conclusion

This article has provided you with a step-by-step process to install Rails into your JRuby installation and get a simple Rails application up and running. Take some time to look further into JRuby and Ruby on Rails and see what it has to offer you.

References

About the Author

Dominic Da Silva (http://www.dominicdasilva.com/) is the President of SilvaSoft, Inc., a software consulting company specializing in Java, Ruby, and .NET-based web and web services development. He has worked with Java since the year 2000 and is a Linux user from the 1.0 days. He is also Sun Certified for the Java 2 platform. Born on the beautiful Caribbean island of Trinidad and Tobago, he now makes his home in sunny Orlando, Florida.





Page 2 of 2



Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 


Sitemap | Contact Us

Rocket Fuel