type is not a member of package controllers <p>I'm currently working on a web app with the play2 framework.</p> <p>Most of the time everything works fine. However when I decide to rebuild the project I get the error: "type HomeController is not a member of package controllers".</p> <p>I've done some research on the web and encountered discussions and topics about this error. However, on all of them this seems to be the answer: </p> <p>"Play 2.4, by default, generates a dependency injected router, unlike previously, when it used a static router. You have two options, remove the routesGenerator line from build.sbt so play will generate a static router, or (better) make your controllers classes instead of objects, and use dependency injection."</p> <p>But, in my project, the HomeController is of type class instead of object and there doesn't seem to be a routesGenerator lin in build.sbt.</p> <p>It is kinda bugging me out, so if someone has an answer to it, that would be super awesome.</p> <p>I managed to get around it two times already but I don't remember how :(.</p> <p>Ok. Time for some specs.</p> <ol> <li>Intellij IDEA 2016.2.5</li> <li>Play 2.5.9</li> <li>Windows 10</li> <li>Java Version 8 Update 111</li> </ol> <p>And now for the code:</p> <p>HomeController:</p> <pre><code>package controllers; import com.avaje.ebean.Ebean; import com.avaje.ebean.Model; import models.Strike; import play.data.Form; import play.data.FormFactory; import play.mvc.*; import views.html.*; import javax.inject.Inject; import java.util.List; import static play.libs.Json.toJson; /** * This controller contains an action to handle HTTP requests * to the application's home page. */ public class HomeController extends Controller { @Inject FormFactory formFactory; public Result index() { return ok(index.render("", formFactory.form(Strike.class))); } public Result addStrike() { Form&lt;Strike&gt; st = formFactory.form(Strike.class).bindFromRequest(); st.get().save(); return redirect(routes.HomeController.index()); } public Result getStrikes(){ List&lt;Strike&gt; strikes = new Model.Finder(Strike.class).all(); return ok(toJson(strikes)); } } </code></pre> <p>Routes:</p> <pre><code>GET / controllers.HomeController.index() POST /strike controllers.HomeController.addStrike() GET /strikes controllers.HomeController.getStrikes() </code></pre> <p>Build.sbt:</p> <pre><code>name := "" version := "1.0-SNAPSHOT" lazy val root = (project in file(".")).enablePlugins(PlayJava, PlayEbean) scalaVersion := "2.11.7" libraryDependencies ++= Seq( javaJdbc, cache, javaWs ) </code></pre> <p>Anyone have any idea?</p> <p>Thanks in advance!</p>