Skip to content


Java is a general-purpose computer programming language that is concurrent, class-based and object-oriented. Compiled Java code can run on all platforms that support Java without the need for recompilation.

Java is available as a module on Apocrita.

Issues with older versions of Java

Versions of Java earlier than 1.8.0_131 suffer from issues with memory and thread usage and should not be used for HPC. This includes the system install of Java, so a module version of Java should always be used in your job script if your application uses Java in any way.


To run Java, simply load the java module.

module load java

To check what version of Java is being used by your current session, run java -version.

To compile your code, use javac


and java to run it

java HelloWorld

Java memory usage

Java tends to allocate large amounts of virtual memory, while only using a small amount. We have set MALLOC_ARENA_MAX=4 in the module file to avoid huge amounts of virtual memory being allocated on compute nodes.

Note that the UGE scheduler kills jobs after the real memory used exceeds the h_vmem value requested in your job, rather than virtual memory. In your job emails, the real memory used is shown by the Max rss value.

As MALLOC_ARENA_MAX is an environment variable, you can either unset it or override its value before the execution of your application if necessary, e.g.


Example jobs

Serial job

Here is an example job running on 4 cores.

#$ -cwd
#$ -j y
#$ -pe smp 4
#$ -l h_rt=1:0:0
#$ -l h_vmem=2G

module load java

java Example