From 286f82a5c5a5b1636ba9cc7ca9693eafa7d9f41f Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Wed, 31 May 2017 16:00:05 +0200 Subject: [PATCH] Don't set java.awt.headless if it was set externally --- compiler/cli/src/org/jetbrains/kotlin/cli/common/CLITool.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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)