Java

Overview

Java is a general-purpose computer programming language that is concurrent, class-based and object-oriented developed by Oracle.

Restrictions on use/License information

Java is released under the Oracle Binary Code license.

There is no restriction on the number of simultaneously running java programs on HTCondor.

Versions installed

JDK version JDK update HTCondor ClassAd
1.7.0 1.7.0_79 HAS_STANDARD_IMAGE
1.8.0 1.8.0_92 HAS_JAVA_1_8

Set up procedure on the HTCondor submit node

To enable the java compiler you must first run the command:

module load JDK/<JDK version>

and then access the compiler using the command javac.

Running the application

In order to run java code on HTCondor, it is first necessary to compile the java code into a java class file using the java compiler.

Step 1 – Compiling your java code

To ensure that your java code will run on HTCondor, it is advisable to compile your java code on the HTCondor submit node.

From a linux terminal prompt, run the command:

javac <java_code>.java

to produce a java class file. Please note that the name of the java class file is determined by the contents of the java file and need not match the name <java_code>.

Step 2 – Submitting your code to run on HTCondor

Running java code on HTCondor is simply a matter of submitting the java class file with a suitable submit file. The following lines are the contents of a simple generic HTCondor submit text file:

Universe = vanilla

Requirements = (Target.Opsys == "LINUX" && Target.Arch == "X86_64" && <HTCondor ClassAd>=?=True)
Request_Memory = 1000

Log = java.log
Output = java.out
Error = java.error
Notification = Error

Should_Transfer_Files = Yes
When_To_Transfer_Output = ON_EXIT

Executable = /opt/JDK/jdk<JDK update>/bin/java
Transfer_Executable = False
Environment = JAVA_HOME=/opt/JDK/jdk<JDK update>
Arguments = <java_code> <input arguments>
Transfer_Input_Files = <java_code>.class

Queue

If your submit file is called submit.txt then your job can be submitted to HTCondor using the command condor_submit submit.txt.

Sample java HTCondor jobs

  1. Java code for calculating Pi using n terms of the Gregory series.

Last modified on January 17, 2018 at 10:47 am by Chris Paul