Spring initializer Kotlin Project Runtime Error

Hi Team,
I have used a very simple option like below at : https://start.spring.io/

  • Gradle Project
  • Kotlin
  • 2.01

Rest everything else is same

I did import this project in intellij latest community edition 2017.3.3
please note : gradle build is working fine but when i am trying to run this project it is giving error

Error:(11, 5) Kotlin: Cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option

I am no where using Java 1.6, still getting such error, please help

It’s not about you using Java 1.6, it’s about you using .class files created by Kotlin compiler set up for backwards compatibility with Java 1.6 - which I believe is the default.

See if you have this section in your build.gradle

sourceCompatibility = 1.8
compileKotlin {
	kotlinOptions {
		freeCompilerArgs = ["-Xjsr305=strict"]
		jvmTarget = "1.8"
compileTestKotlin {
	kotlinOptions {
		freeCompilerArgs = ["-Xjsr305=strict"]
		jvmTarget = "1.8"

Also, the newest version of IntelliJ Community Edition is 2018.1.3 EAP (or 2018.1.2 if you want stable), not 2017.3.3 - you could try it and see if anything changes.

1 Like

Yes I do have this settings but it does not have any impact in 2017.3.3 version atleast.

Thanks for sharing this information, I found this option in settings where kotlin compiler was using 1.6 by default
this problem persists every time when we reopening project after closing back.
compiler is getting reset back to 1.6

I hope 2018.1.2 would solve some of these issues.