You need a Java Development Kit (JDK) of version 8 or higher installed, but it is not necessary to install Gradle because it's bundled with the OpenCms source code project.
Although a server-side Java application, OpenCms uses some UI-related libraries for its image processing functionalities. Standard JDK distributions contain all the UI-related packages needed. There are "slim" JDKs available for headless systems, though, that cannot be used.