Java Compilers (javac)

Overview

The Java compiler javac is installed on the zCSF but should not be used on the login node.

Version 1.6.0 of the OpenJDK is installed on the zCSF.

Restrictions on use

None.

Set up procedure

No modulefile is required – the software is installed system wide and available by default.

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

Running Compiled Java Code

To run a Java code:

java my_app arg1 arg2
       #           #
       #           # Optional args for your class
       #
       # You usually have a compiled my_app.class file
       # in the current directory containing the my_app 
       # compiled class code.

Updates

None.

Last modified on October 20, 2016 at 10:54 am by Site Admin