Friday, July 6, 2012

Getting Started with Play

Create a java project

  1. Download the latest play 2.0 zip from http://playframework.org
  2. Extract the zip file to a convenient location. Usually, I extract and put it in my c:\, so that it is easily accessible from the command prompt.
  3. Add the play framework path in your PATH environment variable.
  4. Open command prompt and 'cd' to your project folder.
  5. Enter 'play new learn-play' from your project folder (where learn-play is the name of your first project). 
  6. This will prompt for what language template. Pick option 2, which is 'simple java application'
  7. This will create a simple java application template. Look for  'OK, application learn-play is created. Have Fun!' message.

Run your application

  1. Open command prompt and 'cd' to your project folder. Then 'cd' to learn-play folder. 
  2. Run 'play' from the command prompt.
  3. This will show the '[learn-play]$' command prompt.
  4. Enter 'run'
  5. This will run the play application in development mode.
  6. From the browser enter 'http://localhost:9000' will run the application.

Create Eclipse Project

  1. From the play '$' prompt, enter command 'eclipsify'
  2. This will create an eclipse project.
  3. From eclipse, right click and choose Import->Existing Projects into Workspace and browse to your lean-play folder.
  4. This will open your learn-play project.
  5. Whenever you install a new module, you have to re-run the 'eclipsify' command

Reference

No comments:

Post a Comment