Replaying a recording

Requirements

A Linux environment with access to the recording file. Usually it’s simplest if this is the same environment in which the application was recorded. However if the recording environment is transient - e.g. a container or on-demand cloud instance - it will be easier to replay in a more interactive environment such as a physical machine, a VM, WSL2, or a scratch container running a supported Linux distribution.

  • JDK that matches the major version of the JRE used to make the recording.

  • The ability to copy the LiveRecorder software into this environment.

  • (Optionally) a copy in this environment of the same build of jar files as supplied to java at record time.

  • IntelliJ IDEA running in the same Linux environment as your application, or running on a separate Windows, macOS or Linux machine. Refer to Getting started if you don’t already have the Time Travel Debug for Java plugin installed and setup in IntelliJ.

  • If the environment is a remote machine, or a VM or container running on your local machine:
    A port (default 9000) opened into the environment for IntelliJ to connect over.

Replaying

The Time Travel Debug for Java IntelliJ plugin provides Run/Debug configurations for use with LiveRecorder for Java:

  • Open your project in IntelliJ if it’s not already open.

  • Under File › Project Structure… › SDKs check that the JDK version matches the version of the JRE used to make the recording.

  • From the Run menu choose Edit Configurations and press the + button at the top left of the Run/Debug Configurations dialog.

  • Add a LiveRecorder › Replay configuration

    • Specify the machine running your application as the Host. Use localhost if you’re replaying on Linux, or in a VM or container running on your local machine.

    • Adjust the Port setting to match the port that you opened up into the remote environment above.

In the replay environment:

  • Unzip the file LR4J-Replay-*.zip. This creates a directory named lr4j.

  • To replay a recording:

    /path/to/lr4j/lr4j_replay -i /path/to/recording.undo -cp classpath
    

    or if not using the default port of 9000:

    /path/to/lr4j/lr4j_replay -i /path/to/recording.undo -cp classpath -p PORT
    

    The classpath should point to the same build of jar files as supplied to java at record time. This argument is optional, but if provided will produce better display of variable contents in the IDE.

Refer to Time travel debugging in IntelliJ for next steps.