Book Image

Play Framework Cookbook - Second Edition

By : Alexander Reelsen, Giancarlo Inductivo
Book Image

Play Framework Cookbook - Second Edition

By: Alexander Reelsen, Giancarlo Inductivo

Overview of this book

<p>As web and mobile systems become more sophisticated, anchoring systems in a mature, solid framework has become increasingly important. Play 2 provides developers with the necessary tools to build robust web applications.</p> <p>This book is a compilation of useful recipes aimed at helping developers discover the power of Play 2. The introductory section serves as a primer to Play Framework, wherein all the fundamentals of the framework are covered extensively. It then explains the usage of controllers and how modules can be leveraged for optimal performance. Next, the book walks you through creating and using APIs, followed by extensive real-world applications. Finally, you will learn to manage applications post production.</p>
Table of Contents (15 chapters)
Play Framework Cookbook Second Edition
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Installing Play Framework


This recipe will guide you through installing Play Framework 2.3 for local development. This section will guide you on the prerequisite installations for Play Framework, such as the Java Development Kit (JDK), and the necessary steps to ensure that Play Framework has access to the JDK's binaries.

Getting ready

Play Framework requires a JDK version of 6 or above. Head over to the Oracle website and download the appropriate JDK for your development machine at http://www.oracle.com/technetwork/java/javase/downloads/index.html.

Once you have downloaded a suitable JDK, ensure that the binary folder is added to the system path:

    $ export JAVA_PATH=/YOUR/INSTALLATION/PATH
    $ export PATH=$PATH:$JAVA_HOME/bin

You can also refer to Oracle's online documentation for more information regarding setting environment variables at http://docs.oracle.com/cd/E19182-01/820-7851/inst_cli_jdk_javahome_t/index.html.

Here's how you can verify that the JDK is now accessible in the system path:

    $ javac -version
    javac 1.7.0_71

    $ java -version
    java version "1.7.0_71"
    Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
    Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

How to do it...

As of Play 2.3.x, Play is now distributed using a tool called Typesafe Activator (http://typesafe.com/activator), install it using following steps:

  1. Download the Typesafe Reactive Platform distribution at https://typesafe.com/platform/getstarted and unzip it at your desired location that has write access.

  2. After downloading and unzipping the distribution, add the Activator installation directory to your system path:

        $ export ACTIVATOR_HOME=</YOUR/INSTALLATION/PATH>
        $ export PATH=$PATH:$ACTIVATOR_HOME
    
  3. Now, verify that Activator is now accessible in the system path:

        $ activator --version
        sbt launcher version 0.13.5
    
  4. You should now be able to create a Play application using the activator command:

        $ activator new <YOUR_APP_NAME>