11 July 2013

How to install play framework 1 and play framework 2 on the same machine?

This is solution  for Windows users.(Linux users knows everything anyway ,so they don't need read that ;) )

So you have play framework 1 and you want do some funky stuff in play framework 2.
It sounds easy until step ... Add the play script to your PATH

Well ,bad news is that you can have 1 path in  global environment variables,so what to do ?It is bit tricky way to do it...but it should works ... (At least, it works for me)

SOLUTION
I assumed that you already install play 1.x (if not do it as is described in play documentation)
  • 0. Download and unzip play 2.x somewhere where you install these things.
  • 1. Go to your play framework 2 installation path:
For example : C:\programs\play-2.1.2
in this folder you can find...
play.bat
  • 2. Simply change name to play2.bat
  • 3. Go to  environment variables settings ( Control Panel\All Control Panel Items\System\Advance system settings and press environment variables )  
and in User variables for yourUsername
(BE CAREFUL WITH WHAT YOU DO WITH STEP3-5 as if things go wrong then you can be screwed !!)
  • 4. find variable path and click edit
  • 5. Add 
C:\programs\play-2.1.2;
in the end of the value and press ok
  • 6.Done
  • Test it:
Run cmd (command line) .btw. it must be a new instance
type:
play
and then type:
play2

You should see:

C:\Users\doominik>play
~ _ _
~ _ __ | | __ _ _ _| |
~ | '_ \| |/ _' | || |_|
~ | __/|_|\____|\__ (_)
~ |_| |__/
~
~ play! 1.2.5, http://www.playframework.org
~
~ Usage: play cmd [app_path] [--options]
~
~ with, new Create a new application
~ run Run the application in the current shell
~ help Show play help
~


C:\Users\ doominik >play2
_ _
_ __ | | __ _ _ _| |
| '_ \| |/ _' | || |_|
| __/|_|\____|\__ (_)
|_| |__/

play! 2.1.2 (using Java 1.6.0_35 and Scala 2.10.0), http://www.playframework.org

This is not a play application!

Use `play new` to create a new Play application in the current directory,
or go to an existing application and launch the development console using `play`.

You can also browse the complete documentation at http://www.playframework.org.


 HAVE FUN!