diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/common/CLITool.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/common/CLITool.kt index e717a99d989..d0e54b0b5b2 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/common/CLITool.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/common/CLITool.kt @@ -158,7 +158,9 @@ abstract class CLITool { fun doMain(compiler: CLITool<*>, args: Array) { // We depend on swing (indirectly through PSI or something), so we want to declare headless mode, // to avoid accidentally starting the UI thread - System.setProperty("java.awt.headless", "true") + if (System.getProperty("java.awt.headless") == null) { + System.setProperty("java.awt.headless", "true") + } val exitCode = doMainNoExit(compiler, args) if (exitCode != ExitCode.OK) { System.exit(exitCode.code)