playframework Java - Hello World The "Hello World" in the Hello World


An "Hello World" doesn't deserve this name if it does not provide a Hello World message. So let's make one.

In the file app/controllers/ add the following method:

public Result hello() {
    return ok("Hello world!");

And in your conf/routes file add the following at the end of the file:

GET     /hello                      controllers.HomeController.hello

If you take a look at your terminal, you should notice Play is compiling your application while you make the changes and reloading the app:

[info] Compiling 4 Scala sources and 1 Java source to /home/YourUserName/HelloWorld/target/scala-2.11/classes...
[success] Compiled in 4s

Navigating to localhost:9000/hello, we finally get our hello world message

enter image description here