[Working with scripts]: System Variable

Using java.lang.System, you would be able to access the system variable.

JDK 1.5
For JDK 1.5, use the following code snippet.

=Code Snippet=
java.lang.System.getenv(name)

Example:

Create a label with the field type set to ‘Script’ and type in the following:

java.lang.System.getenv("temp");

JDK 1.4
For JDK 1.4, ‘java.lang.System.getenv(name)’ is not available as it is deprecated since JDK 1.3 but has been un-deprecated in JDK 1.5.

Steps to be taken :
1/ Set the variable and value at the console
2/ Access using the following codes.

Example:

When launching Elixir Report Professional, include the sentence (-DSample=Test) to the batch file.

=Code Snippet=
java -DSample=Test -jar ERD-Launcher.jar

Create a label with the field type set to ‘Script’ and type in the following:

=Code Snippet=
java.lang.System.getProperty("Sample");