Prerequisites
To run the Play framework, you need Java 5 or the updated JDK. If you want to build the Play framework from the source code, you need to use the Git source code management client to obtain the source code and build it with Ant.
If you are using the MacOS system, Java is built-in. If you are using a Linux system, make sure that you are using Sun-JDK or OpenJDK but not gcj. Many Linux distributions use gcj as the default Java environment by default ). If you are using a Windows system, download and install the latest JDK package. |
Make sure that the Java command can be entered in the command line in the current path.Java-versionCheck ). The Play framework will call the default Java command or call$ JAVA_HOMEJava scripts in the environment variable declaration path.
The command line tool of Play is written in Python. So it should work on any UNIX system, but it must be Python 2.5 or later ). If you are using a Windows system, don't worry. A runtime Python environment is built into the framework.
Download Binary Package
Download the latest Play Binary Package and decompress it. For convenience, you should add the installation directory of Play to the PATH environment variable of the system. If you are in a UNIX system environment, check whether the play script can be run. Otherwise, you can simply execute chmod + x play ). That's all.
Prompt If you need to re-build the Play framework for some reason, you can execute the ant command under the $ PLAY_HOME/framework directory. |
Build with the latest source code
To benefit from the latest improvements and bug fixes of Play, you may want to compile the Play framework directly from the source code. You will need a Git client to obtain the source code and use Ant to build the play framework.
Use the following command line:
- # git clone git://github.com/playframework/play.git
- # cd play/framework
- # ant
In this way, you can use Play.
Use the play command
After correctly installing Play, open a shell and execute play.
- $ play
You will see the default information of play:
You can usePlay help any-command-name-hereFor more help on this command. For example, try:
- # play help run
Create an application
Use the new command to create a new application. You need to specify a unique application name in the current path for the new application.
- # play new myApp
After creating a new application, run the following command to start the application:
- # play run myApp
You can access http: // localhost: 9000 in a browser and view the default page of the application.