IntelliJ IDEA 2021.2 Help

Run/Debug Configuration: Kotlin Script

The Kotlin script run/debug configuration enables you running or debugging Kotlin scripts.

Configuration tab

Item

Description

Script file

Specify here the path to a .kts file to be launched.

VM options

Specify the string to be passed to the VM for launching an application, for example, -mx, -verbose, and so on.

When specifying JVM options, follow these rules:

  • Use spaces to separate individual options, for example, -client -ea -Xmx1024m.

  • If an option includes spaces, enclose the spaces or the argument that contains spaces in double quotes, for example, some" "arg or "some arg".

  • If an option includes double quotes (as part of the argument), escape the double quotes using backslashes, for example, -Dmy.prop=\"quoted_value\".

  • You can pass environment variable values to custom Java properties. For example, if you define a variable MY_ENV_VAR, you can pass it to the foo property as follows:

    -Dfoo=${MY_ENV_VAR}

The -classpath option specified in this field overrides the classpath of the module.

Program arguments

Type a list of arguments to be passed to the program in the format you would use on the command line. Use the same rules as for specifying the VM options.

Working directory

Specify the working directory to be used for running the application. This directory is the starting point for all relative input and output paths. By default, the field contains the directory where the project file resides. To specify another directory, click the Browse button and select the directory.

Expand the list to view available path variables that you can use as a path to your working directory.

Environment variables

Create environment variables and specify their values.

Add dependencies with “provided” scope to classpath

Enable this option to add dependencies with the Provided scope to the runtime classpath.

Shorten command line

Select a method that will be used to shorten the command line if the classpath gets too long, or you have many VM arguments that exceed your OS command line length limitation:

  • none: IntelliJ IDEA will not shorten a long classpath. If the command line exceeds the OS limitation, IntelliJ IDEA will be unable to run your application and will display a message suggesting you to specify the shortening method.

  • JAR manifest: IntelliJ IDEA will pass a long classpath via a temporary classpath.jar. The original classpath is defined in the manifest file as a class-path attribute in classpath.jar. You will be able to preview the full command line if it was shortened using this method, not just the classpath of the temporary classpath.jar.

  • classpath file: IntelliJ IDEA will write a long classpath into a text file.

Use alternative JRE

Select the checkbox, if you want to specify an alternative JRE here; select the required JRE from the list, or click the Browse button and choose the required JRE from the file chooser dialog.

Last modified: 02 August 2022