PlayFramework/play2.3のインストール のバックアップ(No.2)

更新


ソフトウェア/PlayFramework?

概要

思った以上にいろいろ躓いたので。

activator 同梱の play2.3 をダウンロード&解凍

http://www.playframework-ja.org/download

の「オフライン版(342M)」から "typesafe-activator-1.2.2.zip" をダウンロード

LANG:console
> unzip typesafe-activator-1.2.2.zip
> cd activator-1.2.2
> activator.bat
 A Java JDK is not installed or can't be found.
 
 Please go to
   http://www.oracle.com/technetwork/java/javase/downloads/index.html
 and download a valid Java JDK and install before running Activator.
 
 If you think this message is in error, please check
 your environment variables to see if "java.exe" and "javac.exe" are
 available via JAVA_HOME or PATH.

JDK8 をダウンロード&インストール

http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

から、"jdk-8u45-windows-x64.exe" をダウンロード&インストール。

LANG:console
> javac
 'javac' は、内部コマンドまたは外部コマンド、
 操作可能なプログラムまたはバッチ ファイルとして認識されていません。
> "C:\Program Files\Develop\jdk1.8.0_45\bin"\javac
 使用方法: javac <options> <source files>
 使用可能なオプションには次のものがあります。
   -g                         すべてのデバッグ情報を生成する
   -g:none                    デバッグ情報を生成しない
   -g:{lines,vars,source}     いくつかのデバッグ情報のみを生成する
   ...

環境変数の設定

LANG:console
> set JAVA_HOME="C:\Program Files\Develop\jdk1.8.0_45"
> activator
 Files\Develop\jdk1.8.0_45""=="" の使い方が誤っています。

あれ?
https://docs.oracle.com/cd/E19416-01/820-5482/inst_set_jdk_windows_t/

えーと・・・

LANG:console
> set JAVA_HOME=C:\Program Files\Develop\jdk1.8.0_45
> activator
 コマンドの構文が誤っています。

そういうこと?!

どうやらこっちが正しそうだけれど、まだ動かない。

http://stackoverflow.com/questions/24116031/typesafe-activator-java-jdk-not-installed-or-cant-be-found

これか。

LANG:console
> set PATH=C:\Program Files\Develop\jdk1.8.0_45\bin;%PATH%
> activator
 'findstr' は、内部コマンドまたは外部コマンド、
 操作可能なプログラムまたはバッチ ファイルとして認識されていません。
 コマンドの構文が誤っています。

ん???

なぜか PATH に Windows や Windows\System32 が含まれていなかった。

LANG:console
> set PATH=%PATH%;C:\Windows;C:\Windows\System32
> activator
 Getting com.typesafe.activator activator-launcher 1.2.2 ...
 downloading file:////(activator_path)/repository/com.typesafe.activator/activator-launcher/1.2.2/jars/activator-launcher.jar ...
       [SUCCESSFUL ] com.typesafe.activator#activator-launcher;1.2.2!activator-launcher.jar (25ms)
 ...
 
   :: retrieving :: org.scala-sbt#boot-scala
         confs: [default]
         6 artifacts copied, 0 already retrieved (24060kB/72ms)
  Did not detect an activator project in this directory.
 
  There are three ways to run activator:
 
  1. Recommended: try `activator ui` to create a project in the UI
  2. Use `activator new` to create a project on the command line
  3. Load an existing project by re-running activator in a project directory

ようやく動きそう。

activator ui を試す

LANG:console
> activator ui
 Checking for a newer version of Activator (current version 1.2.2)...
    ... found updated version of Activator 1.3.2 (replacing 1.2.2)
    ... Please download a new Activator by hand at http://typesafe.com/ (the late
 st version 1.3.2 isn't compatible with this launcher, generation 0 vs. 1).
 Getting com.typesafe.activator activator-ui 1.2.2 ...
 downloading file:////(activator_path)/repository/com.typesafe.activator/activator-ui/1.2.2/jars/activator-ui.jar ...
         [SUCCESSFUL ] com.typesafe.activator#activator-ui;1.2.2!activator-ui.jar (246ms)
 ...

 :: retrieving :: org.scala-sbt#boot-app
       confs: [default]
       76 artifacts copied, 0 already retrieved (62932kB/1518ms)
 FOUND REPO = activator-local @ file:////(ativator_path)/repository
 Play server process ID is 294224
 [info] play - Application started (Prod)
 [info] play - Listening for HTTP on /127.0.0.1:8888
 [INFO] [04/21/2015 15:35:47.498] [default-akka.actor.default-dispatcher-7] [akka://default/user/home-socket-1] Firing up web socket

となって、勝手にブラウザで http://127.0.0.1:888/ が開いた。

Typesafe Activator-00 startup.png

同時に 「Windows セキュリティの重要な警告」が開いた。

windows-security-warning.png

localhost からの接続のみ受け付ければよいので、念のためチェックを外してキャンセル。

Hello Scala! を作成

Hello Scala! を選んで Create

http://127.0.0.1:888/app/hello-scala

に遷移した。

Typesafe Activator-01 created.png

"Run the app>" を選ぶと、左のメニューで "Run" が選択された状態になって、 中央の Logs の部分に "Hello, world!" が表示された。

左のメニューで "Code" を選び、"src/main/scala/Hello.scala" を選ぶと、 中央にファイル内容が表示されて、その場で編集可能になる。

"Hello, world!" を "Hello, world!!!" と地味に編集して、Ctrl+S で保存。

左のメニューで "Run" を押すと、すでに Logs の部分には "Hello, world!!!" が表示されている。

裏でコンパイルしているはずなんだけれど、あまりにシームレスでびっくりする。


Counter: 8015 (from 2010/06/03), today: 3, yesterday: 4