How to hide console window of the runMainReleaseExecutableMingwX64 build?

  • A compiled Windows exe from runMainReleaseExecutableMingwX64 task always opens a console window next to the game. Is there a build option or a command line flag to disable this console?


    Btw. do you prefer dev feddback here or in the Korge GitHub project issue list? I hope I don't bother you with my questions.

    Best wishes,

  • Dont worry too much about where to place stuff. I personally prefer the forum for quedtions and github for bug reports.

    Yes, you can create a native executable without console by calling gradlew packSomethingIDontRememberRightNow
    It will create a stripped executable called main-stripped.exe (or something similar) that exe should be smaller and also sets the exe subsystem to windows, so no console will be opened.

  • The task names are: packageMingwX64AppDebug and packageMingwX64AppRelease.

    You can also add an icon to the application in the build.gradle by calling:

    korge {
        icon = file("icon.png") // this is the default, if the file exists in the root folder of the project it will be used, but you can change the path here

  • OK, thanks for the hint. Release hides the window. I thought I already tired it in this way before, but maybe I mixed up the gradle tasks. I though runNativeMingwX64Release is simply the same as packageMingwX64AppRelease + run it.
    Also the icon works for Windows. So the note in the korge-hello-world README seems to be outdated. And it's good to know that you can provide a png instead of an ico file.

    Note that windows executables doesn't have icons bundled. You can use ResourceHacker to add an icon to the executable for the moment. Later this will be done automatically.

    Now I have my first real native kotlin game, great! If you want to include also the resources into the exe you can use WinRar to create an self extracting archive without dialogs which starts the exe after unzipping. I was impressed that zipping reduced the file size from 6,36 MB down to 1,82 MB. Say goodbye to JRE👋