- Detected configurations, read from the project’s build files every time they change.
- User configurations you create or save in Run/Debug Configurations.
- Temporary configurations, created when you run the code at the caret or a file. The five most recent are kept.
Detected configurations
When a project opens, OpenIDEA scans its build files (also in nested projects of a folder that holds several) and lists what it can run:
Plugins can contribute more detectors. Detected configurations reload when a build file changes; run Reload Run Configurations from Find Action to force it.
If you edit a detected configuration, the change is saved as a user configuration that overrides it. Removing a detected configuration hides it for this workspace.
Run code from the editor
1
Click the gutter icon
A ▶ icon appears next to
main functions, tests and test classes in Rust, Go, Java, Kotlin, Scala, Groovy,
JavaScript / TypeScript, Python, PHP, Ruby, C# and C / C++. It also appears on scripts entries in package.json.
Click it to choose Run ’…’, Debug ’…’, other executors (such as coverage or profiling) or Modify Run
Configuration….2
Or run the context
Run › Run Context Configuration runs the test or program at the caret, or the current file. The same items
appear in the editor, editor tab and Project view context menus as Run ’…’, Debug ’…’ and More
Run/Debug. On a directory in the Project view, it runs the tests in that directory.
3
Keep it
A context run creates a temporary configuration. Open the configuration chooser and pick Save ’…’ Configuration
to keep it as a user configuration.
Launch a configuration
In the configuration chooser, hold
Shift to debug the configuration instead of running it. The first entry, Current File, runs whatever the active editor holds.
Stop stops the process of the focused Run tab. Elsewhere it stops the only running process, or lists them with Stop All when several run. Press Stop again to kill a process that does not exit.
Run Anything… runs a shell command in the project directory, a run configuration or a build tool goal. Lines that start with mvn or gradle get goal and task completion.
Edit configurations
Open Run › Edit Configurations… (also in the run widget menu). The Run/Debug Configurations dialog lists configurations on the left, grouped by folder.- Add New Configuration (
⌘N/Ctrl+N, orAlt+Insert) opens the list of configuration types. - Copy Configuration, Create New Folder, Move Up / Move Down organize the list.
Deleteremoves the selection. - Edit configuration templates… sets the starting values for new configurations of each type.
- Store as project file decides where the configuration is saved (see Where configurations are stored).
- Modify options (
⌥M/Alt+M) adds optional fields to the form.
Configuration types
The debugger adds attach-only types such as Remote JVM Debug, Go Remote, Python Remote Debug (debugpy), Attach to Node.js and PHP Remote Debug (Xdebug); see Debugging. Plugins can add their own types.
Common fields
- Run on: the local machine, or an SSH host defined in Settings › Build, Execution, Deployment › Run Targets. Debugging is not available on run targets. See SSH.
- Working directory: relative to the project root; empty means the project root.
- Environment variables:
VAR=valuepairs separated by;. The list button opens the Environment Variables dialog, where Include system environment variables can be turned off. - Debug adapter: which debugger Debug uses for this configuration (for example
debugpy,js-debug,codelldb,delve).
Environment variables and .env files
Turn on Modify options › Paths to “.env” files to load one or more .env files (relative to the project root, separated by ;). They support KEY=value, export prefixes, # comments, quoted values and ${VAR} references. Variables set in the configuration override the ones from .env files.
With Include system environment variables on, the process also gets the IDE’s environment and the variables of your login shell.
Modify options
Emulate terminal in output console runs the process in a terminal, for programs that need a TTY. It cannot be combined with Redirect input.
Before launch tasks
Add tasks under Modify options › Add before launch task. They run in order before the process starts:- Run Another Configuration
- Build Project, Build Module, Build Artifacts, Build .NET project (for .NET configurations)
- Run External Tool
- Run Shell Command
- Activate Tool Window
Compound configurations
A Compound configuration starts several configurations at once. Run it to start all of them, or Debug it to debug each of them. Stop from the run widget stops them all.The Run tool window
Each launch opens a tab in the Run tool window (bottom). The toolbar has Rerun, Debug, Rerun Failed Tests (for test runs), Update Application, Find…, Scroll to End, Soft-Wrap, Clear All and Edit Configurations….- File paths and stack trace frames in the output are links.
- Repeated lines can be folded; configure the patterns in Settings › Build, Execution, Deployment › Console, along with the buffer size and the console encoding.
- For test runs the tab shows a test tree next to the output. See Testing.
Import configurations
Two actions in Find Action (also linked from the dialog) import existing configurations:- Import Run Configurations from .vscode/launch.json: Python and Node.js launches and attaches, plus compounds. Fixed variables such as
${workspaceFolder}and${env:NAME}are replaced; entries that use${file},${input:…}or${command:…}are skipped. - Import Run Configurations from JetBrains (.run, .idea): reads
.run/*.run.xml,.idea/runConfigurations/*.xmland.idea/workspace.xml. Python, Django, pytest, npm, Jest, Vitest, Node.js, Shell Script, Application, JAR Application, Spring Boot, Go and compound configurations are converted; other types are skipped.
Where configurations are stored
Both files are plain TOML and can be edited by hand: