{"id":43635,"date":"2026-07-30T12:17:31","date_gmt":"2026-07-30T04:17:31","guid":{"rendered":"https:\/\/www.zhidianwl.net\/zhidianwl\/?p=43635"},"modified":"2026-07-30T12:17:31","modified_gmt":"2026-07-30T04:17:31","slug":"kotlin%e6%89%93%e5%8c%85exe%e6%b3%a8%e6%84%8f%e4%ba%8b%e9%a1%b9%e4%bb%8b%e7%bb%8d","status":"publish","type":"post","link":"https:\/\/www.zhidianwl.net\/zhidianwl\/2026\/07\/30\/kotlin%e6%89%93%e5%8c%85exe%e6%b3%a8%e6%84%8f%e4%ba%8b%e9%a1%b9%e4%bb%8b%e7%bb%8d\/","title":{"rendered":"kotlin\u6253\u5305exe\u6ce8\u610f\u4e8b\u9879\u4ecb\u7ecd"},"content":{"rendered":"<p>Kotlin \u662f\u4e00\u79cd\u5728 Java \u865a\u62df\u673a (JVM) \u4e0a\u8fd0\u884c\u7684\u9759\u6001\u7c7b\u578b\u7f16\u7a0b\u8bed\u8a00\uff0c\u5176\u8bed\u6cd5\u548c Java \u975e\u5e38\u76f8\u4f3c\uff0c\u4f46\u6709\u4e00\u4e9b\u989d\u5916\u7684\u529f\u80fd\u548c\u7b80\u5316\u7f16\u7a0b\u7684\u8bed\u6cd5\u7cd6\u3002\u56e0\u6b64\uff0cKotlin \u4ee3\u7801\u901a\u5e38\u5728 JVM \u4e0a\u4f5c\u4e3a JAR \u6587\u4ef6\u8fd0\u884c\uff0c\u800c\u4e0d\u662f\u5355\u72ec\u7684\u53ef\u6267\u884c\u6587<a href=\"https:\/\/exe.yimenapp.com\/tool-3689.html\">diy\u7535\u8111\u8f6f\u4ef6<\/a>\u4ef6\uff08\u4f8b\u5982 EXE \u6587\u4ef6\uff09\u3002\u7136\u800c\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528\u4e00\u4e9b\u65b9\u6cd5\u5c06 Kotlin \u4ee3\u7801\u6253\u5305\u4e3a EXE \u6587\u4ef6\u3002<\/p>\n<p>\u5728\u6b64\u6587\u7ae0\u4e2d\uff0c\u6211\u4eec\u5c06\u4ecb\u7ecd\u4e24\u79cd\u5c06 Kotlin \u4ee3\u7801\u6253\u5305\u4e3a EXE \u6587\u4ef6\u7684\u65b9\u6cd5\uff1a<\/p>\n<p>1. \u4f7f\u7528 Native Image \u5de5\u5177<\/p>\n<p>2. \u4f7f\u7528 Kotlin\/Native \u7f16\u8bd1\u5668<\/p>\n<p>\u65b9\u6cd5 1\uff1a\u4f7f\u7528 Native Image \u5de5\u5177<\/p>\n<p>[\u6b65\u9aa41] \u5b89\u88c5 GraalVM<\/p>\n<p>\u9996\u5148\uff0c\u6211\u4eec\u9700\u8981\u5b89\u88c5 GraalVM\u3002GraalVM \u662f\u4e00\u6b3e\u9ad8\u6027\u80fd\u7684 Java \u865a\u62df\u673a\uff0c\u652f\u6301\u5404\u79cd\u8bed\u8a00\uff0c\u5982 Java\u3001Kotlin\u3001JavaScript\u3001Python \u7b49\u3002GraalVM \u5305\u542b\u4e00\u4e2a\u540d\u4e3a Native Image \u7684\u5b9e\u7528\u5de5\u5177\uff0c\u7528\u4e8e\u5c06 JVM \u5b57\u8282\u7801\u751f\u6210\u672c\u673a\u53ef\u6267\u884c\u6587\u4ef6\u3002<\/p>\n<p>\u8bbf\u95ee [https:\/\/www.graalvm.org\/downloads](https:\/\/www.graalvm.org\/downloads) \u4e0b\u8f7d GraalVM \u7684 Community Edition\uff0c\u5e76\u6309\u7167\u5b98\u65b9\u6587\u6863\u4e2d\u7684\u8bf4\u660e\u8fdb\u884c\u5b89\u88c5\u3002<\/p>\n<p>[\u6b65\u9aa42] \u5b89\u88c5 Native Image \u547d\u4ee4\u884c\u5de5\u5177<\/p>\n<p>\u6253\u5f00\u7ec8\u7aef\uff0c\u5e76\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u5b89<\/p>\n<p><figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/i.yimenyun.net\/2023-03\/20\/11\/20762987684.jpg\" \/><\/figure>\n<\/p>\n<p>\u88c5 Native Image \u5de5\u5177\uff1a<\/p>\n<p>&#8220;`<\/p>\n<p>gu install native-image<\/p>\n<p>&#8220;`<\/p>\n<p>[\u6b65\u9aa43] \u7f16\u8bd1 Kotlin \u4ee3\u7801\u4e3a JAR \u6587\u4ef6<\/p>\n<p>\u5728\u8fd9\u4e00\u6b65\uff0c\u6211\u4eec\u9700\u8981\u5c06 Kotlin \u4ee3\u7801\u7f16\u8bd1\u4e3a\u4e00\u4e2a JAR \u6587\u4ef6\u3002\u786e\u4fdd\u5df2\u7ecf\u5b89\u88c5\u4e86 Kotlin \u7f16\u8bd1\u5668\uff0c\u5e76\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u7f16\u8bd1 Kotlin \u6e90\u6587\u4ef6\uff1a<\/p>\n<p>&#8220;`<\/p>\n<p>kotlinc HelloWorld.kt -include-runtime -d HelloWorld.jar<\/p>\n<p>&#8220;`<\/p>\n<p>\u8fd9\u5c06\u751f\u6210\u4e00\u4e2a\u540d\u4e3a HelloWorld.jar \u7684 JAR \u6587\u4ef6\u3002<\/p>\n<p>[\u6b65\u9aa44] \u4f7f\u7528 Native Image \u5c06 JAR \u8f6c\u6362\u4e3a EXE<\/p>\n<p>\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u9700\u8981\u4f7f\u7528 Native Image \u5de5\u5177\u5c06\u751f\u6210\u7684 JAR \u6587\u4ef6\u8f6c\u6362\u4e3a EXE \u6587\u4ef6\u3002\u5728\u7ec8\u7aef\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<p>&#8220;`<\/p>\n<p>native-image -jar HelloWorld.jar HelloWorld<\/p>\n<p>&#8220;`<\/p>\n<p>\u8fd9\u5c06\u751f\u6210\u4e00\u4e2a\u540d\u4e3a HelloWorld.exe \u7684\u53ef\u6267\u884c\u6587\u4ef6\u3002<\/p>\n<p>\u65b9\u6cd5 2\uff1a\u4f7f\u7528 Kotlin\/Native \u7f16\u8bd1\u5668<\/p>\n<p>Kotlin\/Native \u662f\u4e00\u79cd\u5c06 Kotlin \u4ee3\u7801\u76f4\u63a5\u7f16\u8bd1\u4e3a\u672c\u5730\u5e73\u53f0\u7684\u53ef\u6267\u884c\u6587\u4ef6\u7684\u6280\u672f\uff0c\u65e0\u9700 JVM\u3002\u8fd9\u610f\u5473\u7740 Kotlin\/Native \u53ef\u4ee5\u76f4\u63a5\u751f\u6210 EXE \u6587\u4ef6\u3002\u5728\u8fd9\u91cc\uff0c\u6211\u4eec\u6f14\u793a\u5982\u4f55\u4f7f\u7528 Kotlin\/Native \u7f16\u8bd1\u5668\u3002<\/p>\n<p>[\u6b65\u9aa41] \u5b89\u88c5 Kotlin\/Native \u7f16\u8bd1\u5668<\/p>\n<p>\u8bbf\u95ee [https:\/\/github.com\/JetBrains\/kotlin\/releases](https:\/\/github.com\/JetBrains\/kotlin\/releases) \u4e0b\u8f7d\u6700\u65b0\u7248\u672c\u7684 Kotlin\/Native \u7f16\u8bd1\u5668\u3002\u89e3\u538b\u7f29\u5e76\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\uff0c\u4ee5\u4fbf\u5728\u547d\u4ee4\u884c\u4e2d\u53ef\u4ee5\u8fd0\u884c `kotlinc-native` \u547d\u4ee4\u3002<\/p>\n<p>[\u6b65\u9aa42] \u7f16\u8bd1 Kotlin \u4ee3\u7801\u4e3a EXE \u6587\u4ef6<\/p>\n<p>\u5728\u7ec8\u7aef\u4e2d\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u7f16\u8bd1 Kotlin \u6e90\u6587\u4ef6\uff1a<\/p>\n<p>&#8220;`<\/p>\n<p>kotlinc-native HelloWorld.kt -o HelloWorld<\/p>\n<p>&#8220;`<\/p>\n<p>\u8fd9\u5c06\u751f\u6210\u4e00\u4e2a\u540d\u4e3a HelloWo<a href=\"https:\/\/www.yimenexe.com\/ruanjian-kaifa-7024.html\">\u600e\u6837\u5c01\u88c5exe\u6587\u4ef6<\/a>rld.exe \u7684\u53ef\u6267\u884c\u6587\u4ef6\u3002<\/p>\n<p>\u901a\u8fc7\u4ee5\u4e0a\u4e24\u79cd\u65b9\u6cd5\uff0c\u6211\u4eec\u53ef\u4ee5\u5c06 Kotlin \u4ee3\u7801\u6253\u5305\u4e3a EXE \u6587\u4ef6\u3002\u8fd9\u4f7f\u5f97 Kotlin \u7a0b\u5e8f\u5177\u6709\u66f4\u5e7f\u6cdb\u7684\u5206\u53d1\u548c\u4f7f\u7528\u53ef\u80fd\u6027\u3002\u7136\u800c\uff0c\u5728\u5b9e\u9645\u5f00\u53d1\u8fc7\u7a0b\u4e2d\uff0c\u8bf7\u6839\u636e\u5b9e\u9645\u9700\u6c42\u548c\u5e73\u53f0\u9009\u62e9\u5408\u9002\u7684\u6253\u5305\u65b9\u6cd5\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Kotlin \u662f\u4e00\u79cd\u5728 Java \u865a\u62df\u673a (JVM) \u4e0a\u8fd0\u884c\u7684\u9759\u6001\u7c7b\u578b\u7f16\u7a0b\u8bed\u8a00\uff0c\u5176\u8bed\u6cd5\u548c Java \u975e\u5e38\u76f8\u4f3c\uff0c\u4f46\u6709\u4e00\u4e9b\u989d\u5916\u7684\u529f\u80fd\u548c\u7b80\u5316\u7f16\u7a0b\u7684\u8bed\u6cd5\u7cd6\u3002\u56e0\u6b64\uff0cKotlin \u4ee3\u7801\u901a\u5e38\u5728 JVM \u4e0a\u4f5c\u4e3a J<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[32521,32520,38,12,64],"topic":[],"class_list":["post-43635","post","type-post","status-publish","format-standard","hentry","category-zhuomianruanjian","tag-idl-exe","tag-matlabexe","tag-38","tag-12","tag-64"],"_links":{"self":[{"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/posts\/43635","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/comments?post=43635"}],"version-history":[{"count":1,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/posts\/43635\/revisions"}],"predecessor-version":[{"id":43646,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/posts\/43635\/revisions\/43646"}],"wp:attachment":[{"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/media?parent=43635"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/categories?post=43635"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/tags?post=43635"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/topic?post=43635"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}