Page History
Table of Contents |
---|
Introduction
This article explains how to access arguments and how to set return variables from a job implemented with Java.
...
In the example the environment variable $VAR1 VAR1
is used.
Returning Variables
...
Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
package js7; import java.io.FileWriter; import java.io.IOException; public class SetAndGetVariables { protected void setVar(String name, String value) throws IOException { try { String tmpFileName = System.getenv("JS7_RETURN_VALUES"); FileWriter fw = new FileWriter(tmpFileName, true); fw.write(name + "=" + value); fw.close(); } catch (IOException ioe) { System.err.println("IOException: " + ioe.getMessage()); } } protected String getVar(String name){ return System.getenv(name); } public static void main(String[] args) throws IOException { SetAndGetVariables setAndGetVariables = new SetAndGetVariables(); System.out.println("var1=" + setAndGetVariables.getVar("var1")); setAndGetVariables.setVar("var1", "newValue"); } } |
Overview
Content Tools