https://kotlinlang.org logo
Title
z

Zeeshan Syed

03/08/2023, 12:02 PM
I have a Multiplatform app with desktop(compose), Android app and web. When I run the desktop module in windows directly from Idea (Play Button), then the JVM application opens. But, if I run
:packageMsi
, install
.msi
and try to run the
.exe
file, then it is not opening. It doesn't even throw any error. How to fix this and how to check logs of an executive application?
v

vbsteven

03/08/2023, 12:12 PM
Does it print anything when opening the .exe from CMD or Powershell?
z

Zeeshan Syed

03/08/2023, 12:14 PM
Nope. I tried
FILE.exe > output.txt
as well And the txt file came out blank
v

vbsteven

03/08/2023, 12:16 PM
maybe something with the packageMSI that needs additional config? Maybe it isn't finding your main class
haven't used that in a while
m

Michael Paus

03/08/2023, 12:26 PM
Did you try the gradle targets runDistributable or runReleaseDistributable? This might provide some more insight into what’s going wrong.
z

Zeeshan Syed

03/08/2023, 12:42 PM
It's unable to find my class Main.kt
But, we don't have class right? We just have a main() function. How do I fix this? In Gradle, i correctly pointed out to the Main.kt file
v

vbsteven

03/08/2023, 12:51 PM
Kotlin automatically creates a class to hold your
main()
based on the file name. If you have your
main()
in
Main.Kt
kotlin will generate a
MainKt
class for the JVM
m

Michael Paus

03/08/2023, 1:06 PM
mainClass = "MainKt"
Note the “Kt” in the name.
z

Zeeshan Syed

03/08/2023, 1:10 PM
ah. Just found out the same. It was "Main.kt" earlier (I guess intellij project template has written it like that). And I tried changing it to Mainkt. But overlooked the capital K Thanks everyone. It's fixed now.
m

mikehearn

03/09/2023, 2:33 PM
Apps just not appearing if the JVM fails to start or if an exception escapes the main thread is an annoying issue. If you use Conveyor instead of the packageMSI task, that is resolved and an error dialog with the exception message and top stack frame will appear, you can also put apps into console mode easily.