Skip to main content

Using the Play console

Launching the console

The Play 2.0 console is a development console based on sbt that allows you to manage a Play application’s complete development cycle.

To launch the console, enter any existing Play application directory and run the play script:

$ cd /path/to/any/application
$ play 
 

 


 
 

Getting help

Use the help play command to get basic help about the available commands:

[My first application] $ help play

 

Running the server in development mode

To run the current application in development mode, use the run command:

[My first application] $ run








In this mode, the server will be launched with the auto-reload feature enabled, meaning that for each request Play will check your project and recompile required sources. If needed the application will restart automatically.

If there are any compilation errors you will see the result of the compilation directly in your browser:

To stop the server, type Crtl+D key, and you will be returned to the Play console prompt.


Compiling

In Play 2.0 you can also compile your application without running the server.

Just use the compile command:

[My first application] $ compile







Debugging

You can ask Play to start a JPDA debug port when starting the console. You can then connect using Java debugger. Use the play debug command to do that:

$ play debug
 
When a JPDA port is available, the JVM wil log this line during boot:

Listening for transport dt_socket at address: 9999
 
Note: Using play debug the JPDA socket will be opened on port 9999. You can also set the JPDA_PORT environment variable yourself using set JPDA_PORT=1234.




Comments