IMPORT JAVA classname

The IMPORT JAVA instruction imports Java™ module elements.

Syntax

IMPORT JAVA classname 
  1. classname is the identifier of the Java class to be imported.

Usage

Using IMPORT JAVA classname, you can import and use a Java class.

Important: At runtime, the imported Java classes are only loaded on demand, when the program flow reaches an instruction that uses the class. For example, when the reaching the declaration of a variable defined to reference an object of a Java class.

The name specified after the IMPORT JAVA instruction is case-sensitive.

The CLASSPATH environment variable defines the directories for Java packages. See the Java documentation for more details.

Actually classname must be a path with package names separated by a dot, so the actual syntax for IMPORT JAVA is:

IMPORT JAVA [ packagename . [...] ] filename

It is allowed to write several IMPORT JAVA instruction with the same class; Compilation will succeed to mimic the Java import rules. However, you should avoid this:

IMPORT JAVA java.util.regex.Matcher 
 IMPORT JAVA java.util.regex.Matcher