Java Compilers
Overview
The Java compiler javac
is installed on the CSF but should not be used on the login node.
Versions 1.6.0, 1.7.0 and 1.8.0 of the OpenJDK are installed on the CSF.
Restrictions on use
None.
Set up procedure
Version 1.8.0 is the default version available if no modulefile is loaded. The following modulefiles are also available if a specific version is required:
module load tools/java/1.8.0 module load tools/java/1.7.0 module load tools/java/1.6.0
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 qrsh 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:
qrsh -l short
#
# 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.
Updates
None.