Java Compilers
Overview
The Java compiler javac is available on the CSF but should not be used on the login node. You need to load one of the available openjdk modules.
Version 1.8.0 of the OpenJDK is installed in the CSF. You do not need to load any module for using this. However, the javac compiler is not installed with it.
You can use any of the the following openjdk modules if you need Java compiler:
Restrictions on use
None.
Set up procedure
Version 1.8.0 is the default JRE version available if no modulefile is loaded. The following modulefiles are also available if a specific version is required:
module load tools/openjdk/25.0.1 # JDK 25 module load tools/openjdk/23.0.2 # JDK 23 module load tools/openjdk/22.0.2 # JDK 22 module load tools/openjdk/20.0.2 # JDK 20 module load tools/openjdk/17.0.2 # JDK 17 module load tools/openjdk/11.0.2 # JDK 11
Running the application
As a quick test, create a file named HelloWorld.java using a text editor on the CSF (e.g. using gedit) which contains the following:
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello World");
}
}
Then compile the code using:
javac HelloWorld.java
Now run the code using:
java HelloWorld # It should print: Hello World
Due to recent excessive memory usage on the login node, all processes running on that node are now restricted in their memory usage. The javac compiler will not execute on the login node, reporting a memory limit error:
Error occurred during initialization of VM Could not reserve enough space for object heap Could not create the Java virtual machine.
You should start an interactive session using srun to launch a shell on a compute node that has more memory. You can then run javac as normal.
Interactive Usage
Request an interactive session using:
On the login node:
srun -p interactive -n 1 -t 0-1 --pty bash
#
# Wait for a new prompt to appear (e.g., [username@node770])
#
javac ...
Running Compiled Java Code
Please read the Java application launcher notes for how to run java code in the batch system with the correct number of threads.
Further info
Updates
None.
