- 下载 我从官网下的当前版本:2.1.1 (它的官网用火狐打开好像有点问题)
- 安装 先确保jdk在1.6以上,然后解压,注意给目录写的权限,因为play生成项目需要再自己目录下写上一些文件 然后把play的目录加入到PATH中
- 测试是否安装成功
play new myweb
系统会自动出一堆提示,根据需要选择$ play new mywebGetting net.java.dev.jna jna 3.2.3 ...:: retrieving :: org.scala-sbt#boot-jna confs: [default] 1 artifacts copied, 0 already retrieved (838kB/86ms)Getting play console_2.9.2 2.1.1 ...:: retrieving :: org.scala-sbt#boot-app confs: [default] 29 artifacts copied, 0 already retrieved (5976kB/356ms)Getting Scala 2.9.2 (for console)...:: retrieving :: org.scala-sbt#boot-scala confs: [default] 4 artifacts copied, 0 already retrieved (20090kB/150ms) _ _ _ __ | | __ _ _ _| || '_ \| |/ _' | || |_|| __/|_|\____|\__ (_)|_| |__/play! 2.1.1 (using Java 1.6.0_18 and Scala 2.10.0), http://www.playframework.orgThe new application will be created in /mnt/ccq_disk/workspace/mywebWhat is the application name? [myweb]> Which template do you want to use for this new application? 1 - Create a simple Scala application 2 - Create a simple Java application> 2OK, application myweb is created.Have fun!
进入刚刚创建的项目目录里,可以看见以下自动生成的文件目录: README app conf project public test 在项目目录里直接运行“play”命令,会进入控制台(Play console),结尾会是[myweb] $ run
“run”是启动项目的命令,默认9000端口,结尾是这样的:[info] play - Listening for HTTP on /0:0:0:0:0:0:0:0:9000(Server started, use Ctrl+D to stop and go back to the console...)
此时在游览器中访问“http://localhost:9000/”,会出现默认Welcome页,至此Play2安装成功。