Example: lr.exit

In the following example, lr.exit is called if a file cannot be opened.

import lrapi.lr;
import java.io.*;
public class Actions {

public int init() {return 0;}
public int action() {
try {
    File file = new File("d:/temp/Java" + Thread.currentThread() + ".txt");
    FileOutputStream fos = new FileOutputStream(file.getName());
    PrintStream outstr = new PrintStream(fos);
}
catch (IOException e) {
    PrintStream outstr = null;
    outstr.println("Init (vuser " + lr.get_vuser_id() + ")");
    lr.exit(lr.EXIT_VUSER, lr.FAIL);
};
return 0;
}//end of action
public int end() {return 0;}
}