1

I'm creating a Kotlin project with Spring boot and Gradle project fromstart.spring.io

When importing this project to IntelliJ and run the project(Alt+Shift+F10) then show this error

Error: Could not find or load main class com.example.demo.DemoApplicationKt 

mainclass :

package com.example.demo import org.springframework.boot.SpringApplication import org.springframework.boot.autoconfigure.SpringBootApplication @SpringBootApplication class DemoApplication fun main(args: Array<String>) { SpringApplication.run(DemoApplication::class.java, *args) } 

How can I solve this problem?

7
  • Please post DemoApplicationKt file Commented Apr 30, 2018 at 12:22
  • what do you mean ? Commented Apr 30, 2018 at 12:52
  • Show your main class for starting spring boot Commented Apr 30, 2018 at 13:13
  • @SangeetSuresh edited Commented Apr 30, 2018 at 13:17
  • @SangeetSuresh Do you have any idea of creating a project with Kotlin and spring boot in IntelliJ? Commented Apr 30, 2018 at 13:25

1 Answer 1

2

You can run the application by clicking the run button(play button) which is on the left side of the main class as shown in below picture.

enter image description here

If you run like this, it will automatically create run configuration

Sign up to request clarification or add additional context in comments.

3 Comments

when I do it shows this error ** Error: Could not find or load main class com.example.demo.DemoApplicationKt**
@MohammadDaliri Please post your run configuration if you have any
it's work fine. change direction source project to another folder and then run

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.