From c851e9d206c92da77cb9f8e8406c6974cbfae855 Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Thu, 1 Jun 2017 00:36:19 +0300 Subject: [PATCH] CLI: use JDK 1.6 to compile the "kotlin" launcher script "kotlin" is used to run programs compiled by "kotlinc" which supports emitting JVM bytecode 1.6, so it should also be runnable on JDK 1.6 --- build.xml | 5 +++-- compiler/cli/cli-runner/cli-runner.iml | 4 ++-- .../cli-runner/src/org/jetbrains/kotlin/runner/runners.kt | 6 +++++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/build.xml b/build.xml index 1ffb5d65990..a4e089f51fb 100644 --- a/build.xml +++ b/build.xml @@ -26,7 +26,6 @@ - @@ -306,6 +305,8 @@ + + @@ -863,7 +864,7 @@ + includeAntRuntime="false" source="1.6" target="1.6"> diff --git a/compiler/cli/cli-runner/cli-runner.iml b/compiler/cli/cli-runner/cli-runner.iml index 44071adbdcd..c1303b33ab0 100644 --- a/compiler/cli/cli-runner/cli-runner.iml +++ b/compiler/cli/cli-runner/cli-runner.iml @@ -1,11 +1,11 @@ - + - + diff --git a/compiler/cli/cli-runner/src/org/jetbrains/kotlin/runner/runners.kt b/compiler/cli/cli-runner/src/org/jetbrains/kotlin/runner/runners.kt index 5ba932c9848..417a94bd21b 100644 --- a/compiler/cli/cli-runner/src/org/jetbrains/kotlin/runner/runners.kt +++ b/compiler/cli/cli-runner/src/org/jetbrains/kotlin/runner/runners.kt @@ -77,9 +77,13 @@ class MainClassRunner(override val className: String) : AbstractRunner() { class JarRunner(private val path: String) : AbstractRunner() { override val className: String = try { - JarFile(path).use { jar -> + val jar = JarFile(path) + try { jar.manifest.mainAttributes.getValue(Attributes.Name.MAIN_CLASS) } + finally { + jar.close() + } } catch (e: IOException) { throw RunnerException("could not read manifest from " + path + ": " + e.message)