Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing play framework

I am on windows 7 and I am trying to install play framework.

I created the environment variable in system variables with
variable name: play, value: c:\webapp\play\

When I am trying to run play help from commander it says

play is not recognized as an internal or external command, operable program or 
batch file and it is running only in the directory of c:webapp\play.

Am I doing something wrong?

like image 444
user1392203 Avatar asked May 13 '12 17:05

user1392203


People also ask

How do I run Play framework in Windows?

To run the Play framework, you need JDK 6 or later. If you are using MacOS, Java is 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 distros). If you are using Windows, just download and install the latest JDK package.

What is Play framework used for?

Play Framework makes it easy to build web applications with Java & Scala. Play is based on a lightweight, stateless, web-friendly architecture. Built on Akka, Play provides predictable and minimal resource consumption (CPU, memory, threads) for highly-scalable applications.

What is SBT in Play framework?

sbt : The sbt settings that describe building your application. /conf : Configuration files for your application. /project : Further build description information. /public : Where static, public assets for your application are stored. /test : Where your application's test code will be stored.


4 Answers

To be able to run Play anywhere on the command line, create a PLAY_HOME environment variable pointing to the play folder, for e.g. c:\play-2.0.1, and add %PLAY_HOME% to the PATH environment variable.

like image 134
Muhammad Imran Saeed Avatar answered Jan 01 '23 12:01

Muhammad Imran Saeed


Muhammad is correct. The only thing I would add is this: After saving the environment variables, I noticed that one must:

  1. close ALL explorer windows
  2. open a new one
  3. open a new cmd prompt

and then I saw the play_home in the path and play worked everywhere. For some reason, updating the environment variables didn't refresh existing windows.

UPDATE:
If you're in a hurry and feeling rebellious, open a cmd prompt window first, then kill explorer.exe, then restart explorer.exe in the cmd window.
That should refresh everything but be careful...

like image 29
djm Avatar answered Jan 01 '23 12:01

djm


Here is how I have set it up for others in the past.

Create a directory c:\playframework

Create two more inside of this

framework and apps

I then have a bat file called env.bat containing the following

set PATH=%path%;c:\playframework\framework\'

You can then run env.bat to make sure play is initialise.

like image 28
Codemwnci Avatar answered Jan 01 '23 12:01

Codemwnci


I realized that it doesn't work if you have a space in your path to the play framework.

So instead of

C:\Folder with space\PlayFramework

try

C:\FolderWithoutSpace\PlayFramework

This fixed it for me, guess it has to do with the play batch file which doesn't handle paths with spaces correctly. Stumbled upon this question, when searching for a solution, so it might help some other folks.

like image 22
coeing Avatar answered Jan 01 '23 10:01

coeing