Java is a computer programming language that is concurrent, class-based, object-oriented, and specifically designed to have as few implementation dependencies as possible. It is intended to let application developers "write once, run anywhere" (WORA), meaning that code that runs on one platform does not need to be recompiled to run on another. Java applications are typically compiled to bytecode (class file) that can run on any Java virtual machine (JVM) regardless of computer architecture. Java is, as of 2012, one of the most popular programming languages in use, particularly for client-server web applications, with a reported 9 million developers. Java was originally developed by James Gosling at Sun Microsystems (which has since merged into Oracle Corporation) and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++, but it has fewer low-level facilities than either of them.

The Java home page is at

Available modules

Packages with modules

Module NeSI Cluster
java/1.5 fitzroy
java/1.6 fitzroy
java/1.8 fitzroy
Java/1.8.0_144 pan
Java/1.7.0_51 pan
Java/1.8.0_5 pan
Java/1.8.0_40 pan

Licensing requirements

All versions of Java on NeSI clusters have been made available by their respective owners at no cost under a limited, closed-source licence. The full licence terms and conditions for any given version of Java can be found by following the directions in ${JAVA_HOME}/LICENSE.

Example scripts

Example script for the Pan cluster

#!/bin/bash -e

#SBATCH --job-name      MyJavaJob
#SBATCH --account       nesi99999
#SBATCH --time          01:00:00
#SBATCH --cpus-per-task 8                # 8 OpenMP threads
#SBATCH --mem-per-cpu   4G               # 4,096 MB of memory per thread
#SBATCH --output        MyJavaJob.%j.out # Include the job ID in the names of
#SBATCH --error         MyJavaJob.%j.err # the output and error files

module load Java/1.8.0_40
java -Xmx24576m -jar /path/to/foo.jar

Example script for the Fitzroy cluster

#!/bin/bash -e

#@ job_name         = MyJavaJob
#@ account_no       = nesi99999
#@ class            = General
#@ wall_clock_limit = 01:00:00
#@ job_type         = parallel
#@ node             = 1
#@ tasks_per_node   = 1
#@ parallel_threads = 64
#@ initialdir       = /hpcf/working/nesi99999/MyJavaJob
#@ output           = $(job_name).$(jobid).out
#@ error            = $(job_name).$(jobid).err
#@ queue

# LoadLeveler has an annoying habit of transferring parts of the user's
# environment as it existed at the time of submission to the job. Clear any
# loaded modules.
module purge

module load java/1.6
java -Xmx24576m -jar /path/to/foo.jar

Further notes

Memory management and the -Xmx option

Java has an unfortunate habit of going beyond the memory allocated to it by the scheduler if left to its own devices. As the scheduler will kill jobs that do such things, it is important to restrict the heap space that Java can request so that the Java processes have the necessary room to expand into. The way this is done is via the -Xmx option.

We recommend setting the -Xmx option to no more than 75% of the requested memory. For example, if your job asks the scheduler for 32 GB of memory, you should provide the Java executable with -Xmx24576m, which will cap its heap usage to 24 GB.

Was this article helpful?
0 out of 0 found this helpful