Installation guide 安装手册

Prerequisites 前提条件

To run the play framework, you need Java 5 or later. If you wish to build play from source, you will need the Bazaar source control client to fetch the source code and Ant to build it. 要运行Play框架,你需要Java 5以后的的JDK。如果你想从源码构建play框架,你需要用Bazaar源码控制的客户端去获取源代码并用Ant创建它。 If you are using MacOS, java is just built-in. If you are using linux, make sure to use either the Sun-JDK or OpenJDK (and not gcj which is the default java command on many linux distro). If you are using Windows, just download and install the latest JDK package. 如果你用MacOS系统,java是内建的。如果你用Linux系统,确定你使用的是Sun-JDK或者OpenJDK(不要是gcj,很多linux发行版默认都用gcj作为默认的java环境)。如果你用Windows系统,只要下载并安装最新发行的JDK包。 Be sure to have java in the current path (try to type java -version to check). Play will use the default java or the one available at the $JAVA_HOME path if defined. 确定java在当前路径(可以通过在命令行输入java -version检查)。Play框架将调用默认java或者一个在$JAVA_HOME环境变量声明的路径里的java。 The play command line utility uses python. So it should work out of the box on any UNIX system. If you’re running Windows, don’t worry, a python runtime is bundled with the framework. play框架的命令行工具是用python写的。所以它应该可以在任意Unix系统上工作,如果你是Windows系统,别担心,一个python的运行环境已经内建在框架里了。

Download the binary package 下载二进制包

Download the latest play binary package and extract the archive. For convenience, you should add the framework installation directory to your system PATH. If you’re on UNIX, make sure that the play script is runnable (otherwise simply do a chmod +x play). That’s all. 下载最新的play框架二进制包并解压缩。为了方便,你应该将play框架的安装目录添加到你系统的path环境变量里。如果你用unix,确认play脚本可以运行(否则可以执行chmod +x play. Tip 建议

If you need to rebuild the framework for whatever reason, run ant from the $PLAY_HOME/framework directory. 如果你需要重建框架,从 $PLAY_HOME/framework 目录运行ant

Build from the latest sources 从最新源码建立

To benefit from the latest improvements and bug fixes, you may want to compile play from sources. You’ll need a Bazaar client to fetch the sources and Ant to build the framework. 为了最新的改善和bug修复,你也许想从源代码编译play框架。你将需要一个Bazaar客户端去获取源代码并用Ant建立play框架。 From the command line: 通过下面的命令行建立
# bzr checkout lp:play

cd play/framework

ant

The Play framework is ready to use. lp:play currently aliases to http:bazaar.launchpad.net/%7Eplay-developers/play/1.0/

Using the play command 是用play命令

When the framework is correctly installed, open a shell and execute play. 当框架正确安装后,打开一个shell并执行play
$ play
You should see the play default message: 你应该看到play的默认信息 You can get more help on any specific command using play help any-command-name-here. For example, try: 你可以获得更多帮助在任何具体命令上用 play help any-command-name-here例如,尝试
# play help run

Creating a new application 创建一个新的应用

Use the new command to create a new application. You must give a non-existent path where the application will be created. 用new命令创建一个新的应用。你必须给一个不存在的名字,才可以创建应用(就是给一个以前没有的项目名字)
# play new myApp
Will create a new application. Start it with: 创建一个新的应用,用下面命令
# play run myApp
You can then open a browser at http://localhost:9000 and see the default page for the application. 你可以用浏览器访问 http://localhost:9000并看到应用的默认页面。 Your play environnement is ready
  你的play框架已经准备好了 关于如何使用play框架,可以参考视频 http://www.xinlogs.com/playframework-video/