No main manifest attribute


#1

I have set up a Kotlin environment on my desktop and laptop, however on my laptop only I get “no main mainfest attribute” error when I execute the jar file. Upon inspecting both jar files there are differences. The desktop file has the .class file in the root, but is missing in the laptop generated jar. Under the “META-INF” folder the desktop file has a “main.kotlin_module” and a “MANIFEST.MF” file. The laptop jar file is missing the “main.kotlin_module” file.

On both systems I’m using Kotlin version 1.1.2-5 and Java version 1.8.0 131-b11. The command line used for compile is “kotlinc HelloWorld.kt -include-runtime -d”.

I’m at a loss on why the two Jar files are being generated differently? Any clues on what to check would be appreciated.

Michael.


#2

Please paste the exact commands that you use to compile and run the application on both devices, along with their output.


#3

Udalov,

I figured it out. I’m using VisualStudio Code for my editor. On the laptop I keyed in the simple hello world code and apparently did not explicitly save it from the menu. But what VSC does when you key in some code before you explicitly save it, it creates an empty file on the file system until you save it. What is misleading is you can exit the program and restart and your unsaved code is still there. There are no warnings you have unsaved code. When I was going to reply to your request for further information is when I noticed the source file on the laptop directory had a zero file size.

Thanks,

Michael