読者です 読者をやめる 読者になる 読者になる

by shigemk2

当面は技術的なことしか書かない

Play Frameworkを始めよう

Play

前置き

ところどころ出てくる下のメッセージは…

Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8

f:id:shigemk2:20140114210118j:plain

うそです。 JDEEで日本語が含まれるファイルをコンパイルすると文字化けする件 - by shigemk2

雛形をplay new で作る

$ play new PlayApp
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
       _
 _ __ | | __ _ _  _
| '_ \| |/ _' | || |
|  __/|_|\____|\__ /
|_|            |__/

play 2.2.0 built with Scala 2.10.2 (running Java 1.7.0_45), http://www.playframework.com

The new application will be created in /Users/shige/projects/PlayApp

アプリケーション名を決める

What is the application name? [PlayApp]
>

(今回はデフォルト)

Javaで作るかScalaで作るかを決める

Which template do you want to use for this new application?

  1             - Create a simple Scala application
  2             - Create a simple Java application

> 2
OK, application PlayApp is created.

Have fun!

早速実行してみる

$ cd PlayApp
$ play run
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
Getting org.scala-sbt sbt 0.13.0 ...
:: retrieving :: org.scala-sbt#boot-app
    confs: [default]
    43 artifacts copied, 0 already retrieved (12440kB/1791ms)
[info] Loading project definition from /Users/shige/projects/PlayApp/project
[info] Set current project to PlayApp (in build file:/Users/shige/projects/PlayApp/)
[info] Updating {file:/Users/shige/projects/PlayApp/}playapp...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.

--- (Running the application from SBT, auto-reloading is enabled) ---

[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...)

[info] Compiling 4 Scala sources and 2 Java sources to /Users/shige/projects/PlayApp/target/scala-2.10/classes...
[warn] Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
[info] play - Application started (Dev)

ね、簡単でしょ?

f:id:shigemk2:20140114210323p:plain