There are multiple versions of Java available on HPC3. Using the default is recommended.

  • OpenJDK 1.8.0 (default)
  • OpenJDK 1.7.0
  • Oracle Java 1.8.0
  • Oracle Java 1.7.0

The full path to each is, respectively:

  • /usr/lib/jvm/java-openjdk/jre/bin/java
  • /usr/lib/jvm/java-1.7.0-openjdk/jre/bin/java
  • /usr/lib/jvm/java-oracle/jre/bin/java
  • /usr/lib/jvm/java-1.7.0-oracle/jre/bin/java

If you would like to change the default to Oracle, please add the following code to your job script or ~/.bashrc file.

export JAVA_HOME=/usr/lib/jvm/java-oracle
export JRE_HOME=/usr/lib/jvm/java-oracle/jre
export PATH=/usr/lib/jvm/java-oracle/bin:/usr/lib/jvm/java-oracle/jre/bin

If you receive the error…

Error occurred during initialization of VM
Could not reserve enough space for object heap
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

you may need to adjust the memory heap size that Java manages, as the job queue will kill any process that exceeds its limits. This can be done with the _JAVA_OPTIONS environment variable, which can be set in a job script or ~/.bashrc file, or at the command line:

export _JAVA_OPTIONS="-Xms256m -Xmx4g" 
java -Xms128m -Xmx2048m -jar myprogram.jar