Using the IMAS-Java¶
Making the IMAS-Java available for use¶
When you’re working with a local installation (see the building and installation documentation), you can source the installed environment file:
Set environment variables (replace
<install_dir> with the folder of your local install)¶source <install_dir>/bin/al_env.sh
Using the Access Layer with your Java program¶
The following example program will load the Java interface to the Access Layer to print the version of the access layer and data dictionary.
imas_hello_world.java¶// Import the Access Layer
import imasjava.imas;
public class imas_hello_world {
public static void main(String[] args) {
System.out.println("Hello World!");
System.out.println("Access Layer version info:");
System.out.println(" Low level version: " + imas.get_al_version());
System.out.println(" Data Dictionary version: " + imas.al_dd_version);
System.out.println(" Java HLI version: " + imas.al_java_version);
}
}
See also
If you save this as a file imas_hello_world.java, you can run it as
follows:
$ java imas_hello_world.java
Hello world!
Access Layer version info:
Low level version: 5.0.0
Data Dictionary version: 3.39.0
Java HLI version: 5.0.0
Congratulations if this runs successfully! You have included the Java Access Layer successfully in a program. In the next sections of the documentation you can see how to: