Noob question on running a jar file

Hi, brand new to kotlin, just started this week.

I’ve got a simple serverlet that I made with the default settings with ktor. I can run it from IntelliJ, but when I build it into a jar file and attempt to use java -jar to run it, I get the error:

Error: Could not find or load main class com.brandon.ApplicationKt

I’ve checked the manifest file, it has com.brandon.ApplicationKt listed as the Main-Class. Application.kt has the main function in it. I don’t know what else is wrong.

Is your main function outside of the class? Because the main function has to be static therefore it has to be outside of the class

So, I’ve fiddled with this for a few days, and the kind people over on r/intellij were able to help me narrow down the problem to Intellij itself packaging the jar file incorrectly, thus the manifest in the jar file doesn’t match the manifest in resources/META-INF/MANIFEST.MF and is missing the Main-class: tag.

I have not figured out how to fix this as of yet. I’ve wiped out the project and restarted about a half dozen times now, so the name has changed. I can actually get the jar file to run with this command:
java -cp budgetmaster.jar com.budgetmaster.ApplicationKt

But it crashes with an exception immediately, so apparently there are more things Intellij is doing wrong that I’ll have to sort out as well.

I solved the issue, come to find out, you cannot use Intellij to package ktor projects, but they provide a script for doing it correctly.