You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add Kotlin Support: "No main class found" for kotlin projects #63
I have two projects lets call them A and B. B is a library to be used inside of A but for testing I want to be able to start a main that is inside of A this all work in gradle on the command line. I accomplish this by setting the following in project B
In this extension, when start a project X, it first searches main classes within this project, and creates an entry in launch.json if not exists, then launches it.
AFAIK, I don't think the dashboard can help you do that.
But I already have an entry in launch.json that works. I use it for debugging. Why can't the dashboard just use that? If there are no main classes within the project fall back to what is in launch.json
I am unable to start the service when I use Kotlin with vscode spring boot dashboard, getting error as "No main class is found" where as it works fine when I use Java.
I am unable to start the service when I use Kotlin with vscode spring boot dashboard, getting error as "No main class is found" where as it works fine when I use Java.
Currently it's Java only, it asks Java Debugger about the main class info, and then requests it to launch a debug session. And there is no good Kotlin language server for the moment.
Edgardo Vega (@vegaed)
To be honest, I don't understand your use case very well. If you already have an existing entry in launch.json, and you exactly want to launch that, I think F5 is there for you.
If there are no main classes within the project fall back to what is in launch.json
What if I have multiple entries defined in the launch.json? Then which one should it "fall back" to ?
This issue has been closed automatically because it needs more information and has not had recent activity. Please reach out if you have or find the answers we need so that we can investigate further.
any update on this issue? I get the same problem, it doesn't find the main class when it's kotlin. Also, there is actually a Kotlin language server
I am unable to start the service when I use Kotlin with vscode spring boot dashboard, getting error as "No main class is found" where as it works fine when I use Java.
Currently it's Java only, it asks Java Debugger about the main class info, and then requests it to launch a debug session. And there is no good Kotlin language server for the moment.
As I clarified, Kotlin is not supported for the moment. This extension relies on Spring Boot Tools to recognize boot projects, which depends on Language Support for Java.
To get Kotlin projects working, I think the prerequisites include at least:
Find an approach to recognize Kotlin boot projects, distinguish from Java boot projects.
Add some logic to delegate corresponding running/debugging tasks to Kotlin extension.
If you are interested in supporting Kotlin, feel free to discuss and contribute.
I get this error message occasionally on a spring boot project I'm working on (twice in 2 days), it comes on the heels of me stopping a running "spring boot server" and attempting to restart it...
On the restarting the "spring boot server" this "No main class found." appears and I must go through and manually dirty (make a change or add a comment to the file) and re-save every class used in the project to trigger it to rebuild.
So this problem isn't specific to kotlin, my app is java / spring boot / maven.
Working on a pr for this now, but noticed this extension relies on the java extension pack to find the main function. There seem to be a few options here. Wait until a kotlin plugin has the ability to make these calls itself, code the functionality directly into the extension, or have the user manually set it up in the .vscode/launch.json file.
Activity
Eskibear commentedon Jan 28, 2019
In this extension, when start a project X, it first searches main classes within this project, and creates an entry in launch.json if not exists, then launches it.
AFAIK, I don't think the dashboard can help you do that.
vegaed commentedon Jan 28, 2019
But I already have an entry in launch.json that works. I use it for debugging. Why can't the dashboard just use that? If there are no main classes within the project fall back to what is in launch.json
consultantdwaraka commentedon Jan 31, 2019
I am unable to start the service when I use Kotlin with vscode spring boot dashboard, getting error as "No main class is found" where as it works fine when I use Java.
Eskibear commentedon Jan 31, 2019
Currently it's Java only, it asks Java Debugger about the main class info, and then requests it to launch a debug session. And there is no good Kotlin language server for the moment.
vegaed commentedon Jan 31, 2019
So back to why cant the extension just see I have an existing entry in launch.json and use that to start the service?
Eskibear commentedon Jan 31, 2019
Edgardo Vega (@vegaed)
To be honest, I don't understand your use case very well. If you already have an existing entry in launch.json, and you exactly want to launch that, I think F5 is there for you.
What if I have multiple entries defined in the launch.json? Then which one should it "fall back" to ?
no-response commentedon Apr 9, 2019
This issue has been closed automatically because it needs more information and has not had recent activity. Please reach out if you have or find the answers we need so that we can investigate further.
yairkukielka commentedon Nov 28, 2019
any update on this issue? I get the same problem, it doesn't find the main class when it's kotlin. Also, there is actually a Kotlin language server
Eskibear commentedon Nov 29, 2019
As I clarified, Kotlin is not supported for the moment. This extension relies on Spring Boot Tools to recognize boot projects, which depends on Language Support for Java.
To get Kotlin projects working, I think the prerequisites include at least:
If you are interested in supporting Kotlin, feel free to discuss and contribute.
[-]No main class found[/-][+]Add Kotlin Support: "No main class found" for kotlin projects[/+]deftdawg commentedon Sep 8, 2021
I get this error message occasionally on a spring boot project I'm working on (twice in 2 days), it comes on the heels of me stopping a running "spring boot server" and attempting to restart it...
On the restarting the "spring boot server" this "No main class found." appears and I must go through and manually dirty (make a change or add a comment to the file) and re-save every class used in the project to trigger it to rebuild.
So this problem isn't specific to kotlin, my app is java / spring boot / maven.
kuercan commentedon Dec 20, 2024
Wow, it's been five years already, and we're still running into that Kotlin issue. It's still causing us trouble
kuercan commentedon Dec 20, 2024
As a workaround for Kotlin developers trying to run Spring Boot with this extension, I created a Java main class that calls the Kotlin one.
Soap1196 commentedon Jul 10, 2026
there is now an official language server for vs code for kotlin from jetbrains. I think headway can be made on adding this capability
Soap1196 commentedon Jul 12, 2026
Working on a pr for this now, but noticed this extension relies on the java extension pack to find the main function. There seem to be a few options here. Wait until a kotlin plugin has the ability to make these calls itself, code the functionality directly into the extension, or have the user manually set it up in the .vscode/launch.json file.