Recording at Startup of the Application
To enable recording from startup of an application, use the following command-line options, based on your use-case:
java -XX:StartFlightRecording=filename=/tmp/rec.jfr,duration=180s -jar my_app.jar
See JFR Command Line Options for a complete overview of the available options.