Setting up Hadoop on Endless

Hello, I have project in which I need to set Hadoop cluster using 2 laptops with plus 2 virtual machines. I succeded to set up the Hadoop on Ubuntu using the GNOME Boxes. When I started installing the JDK on Endless I came with this problem

sudo mkdir /usr/lib/java
mkdir: cannot create directory ‘/usr/lib/java’: Read-only file system

As of version 3.0 Endless OS has adopted Flatpak, a new distribution system for Linux applications