Skip to content

Instantly share code, notes, and snippets.

@mikamboo
Last active December 17, 2015 00:59
Show Gist options
  • Save mikamboo/5524804 to your computer and use it in GitHub Desktop.
Save mikamboo/5524804 to your computer and use it in GitHub Desktop.
Play Framework 2.x on windows with Eclipse from Scratch course. Run on local and deploy on Heroku.

Play Framework installation

  1. Downloads & prerequistes

  • Play Framework : Link
  • Heroku Toolbelt : Link
  1. Environment variables

  • Be sure to set the environment variables: JAVA_HOME (pointing to your Java SDK dir). "javac" cmd must work.
  • And add the following locations to your PATH variable : JAVA_HOME/bin (%JAVA_HOME%\bin)
  • Add play cmd to your path (PLAY_INSTALL_dir\bin)
  • Add heroku cmd to your path (HEROKU_INSTALL_dir\bin)
  1. Get and setup Eclipse

  • Get classic or Java developper version of Eclipse IDE
  • Increase eclise heap size: -Xms512m -Xmx1024m
  • Add Scala sdk to eclipse : Help > Eclipse Marketplace > In seach input type "Scala" > Select "Scala IDE for eclipse"
  1. Create and run your first App :

In Command prompt :
$ play new PROJECT_NAME 
$ play eclipse  (Transform you app to an Eclipse project)
$ play run
  • App started on local server and run at : localhost:9000
  • You can also now import the project into eclipse IDE and play with.
  1. Deploy on Heroku

You need to create a file named Procfile in the root of your project and for Play it should contain :

web: target/start -Dhttp.port=${PORT} -DapplyEvolutions.default=true -Ddb.default.url=${DATABASE_URL} -Ddb.default.driver=org.postgresql.Driver

Add PgSQL driver depedency, specify it into the project/Build.scala file:

val appDependencies = Seq(
  "postgresql" % "postgresql" % "8.4-702.jdbc4"
)
  1. Available Cloud Hosters for Play / Scala applications

Problème connus :

  • windows config env. variable missing "javac" => add java jdk to yout path (eg. java\jdk1.7.x\bin)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment