A framework that is not as well known as others but is very versatile to use is Play Framework. Today we will talk about it and learn how to install it on Debian 11.
What is Play Framework?
Built on top of Akka, Play provides predictable and minimal resource consumption (CPU, memory, threads) for highly scalable applications. Contrary to the belief that Java is too heavy, Play allows us to use it without so many problems.
On the other hand, the compiler and runtime (JVM) do the heavy lifting so that your applications run superfast and keep running under load. So, we can get the most out of it.
Install Play Framework
Installing this framework is not as complicated as it sounds. However, we will have to install some tools beforehand to make things easier. Let’s get started.
Install SDK on Debian 11
The first thing we need to do is to access our terminal or via SSH and update the whole system.
sudo apt update
sudo apt upgrade
Next, you have to install some necessary packages.
sudo apt install git unzip zip curl
Next, you can use
curl to download the SDK installation script. At once, we will run this script. Then to download and install SDK, just run.
curl -s "https://get.sdkman.io" | bash
To complete the process, run this command after the previous command has finished executing.
Check the changes made by verifying the SDK version installed.
Installing Java and SBT using SDK on Debian 11
Play only supports Java versions 8 and 11. So, we have to choose one of these and for that, we will use SDK.
sdk install java 11.0.14-tem
Java is followed by SBT. To install it using SDK, just run.
sdk install sbt
Download Play Framework examples
To check that we can use Play, we first have to download some examples that will help us to know if everything we have done is OK.
To download it, just clone a file from the GIT repository:
git clone https://github.com/playframework/play-samples.git
Access the folder that has been generated
And you can run the program by
Then you can access it from a web browser at the address
But if you are doing this test from a virtual machine or a VPS, then you have to enable access to any host. To achieve this, edit the configuration.
And add the following
allowed = ["."]
Save the changes and you are done.
This indicates that Play is ready to use.
Create a new project with Play Framework
Now we are ready to create a new project with Play. To achieve this, just create a folder with the name of your project.
After accessing it, we will be able to download the Play project template.
sbt new playframework/play-java-seed.g8
And when we finish, we can start working.
Play Framework combines the power of Java with Scala to make lightweight but scalable, robust web applications.
I hope this post has helped you, and you can share it with others.