Oracle GlassFish Server 3.0.1 Scripting Framework Guide

ProcedureTo Create the hello Application

This procedure explains how to create a simple Rails application, named hello, and deploy it on GlassFish Server 3.0.1.

Before You Begin

JRuby and Rails must be installed as described in Installing JRuby and Rails before proceeding with the instructions in this section.

  1. Select or create a directory in which you want to create the sample application.

    In this example, a directory named /apps/jruby-apps is used.

  2. Change to the directory you are using for your applications, and then create a Rails application named hello.

    cd /apps/jruby-apps
    jruby -S rails hello

    This command creates the hello subdirectory, which contains a set of automatically generated files and subdirectories.

    The directories containing the files that you will likely use most are:

    • app: Application code (controllers, helpers, models, views, layouts)

    • config: Configuration files (environments, initializers, locales), including database, boot, and route files

    • public: Files and resources that need to be accessed directly rather than accessed through the Rails call stack; includes images, style sheets, and HTML files

  3. Proceed with the instructions in To Create the Controller and the View.