Share this page

# 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;}
    }

Tips to improve your search results... VuGen Function Reference Version 25.1-25.3 Function Reference 25.1-25.3 All View Local Help Center View Online Help Center Version: