I am on windows 7 and I am trying to install play framework.
I created the environment variable in system variables with
variable name:
setx PATH "%PATH%;c:\path\to\play" /m
<--substitute c:\path\to\play with your pathMuhammad is correct. The only thing I would add is this: After saving the environment variables, I noticed that one must:
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...
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.
To start a play project, an alternative is to download the activator and create a play project. Download the activator and add it to the environment variable. Open a command prompt and use the following command to create a java project: C:\ activator new project-name play-java If you want to create a scala project C:\ activator new project-name play-scala
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.
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.