{"id":2502,"date":"2023-07-03T12:19:15","date_gmt":"2023-07-03T04:19:15","guid":{"rendered":"https:\/\/app.60day.cn\/appday\/?p=2502"},"modified":"2023-07-03T12:19:15","modified_gmt":"2023-07-03T04:19:15","slug":"idea-%e7%94%9f%e6%88%90-exe%e6%9c%89%e4%bb%80%e4%b9%88%e7%89%b9%e6%80%a7%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/app.60day.cn\/appday\/kaifaexe\/2502\/","title":{"rendered":"idea \u751f\u6210 exe\u6709\u4ec0\u4e48\u7279\u6027\uff1f"},"content":{"rendered":"<p>Title: \u5229\u7528 IntelliJ IDEA \u751f\u6210\u53ef\u6267\u884c\u6587\u4ef6\uff08exe\uff09\u7684\u539f\u7406\u4e0e\u8be6\u7ec6\u4ecb\u7ecd<\/p>\n<p>IntelliJ IDEA \u662f\u4e00\u4e2a\u975e\u5e38\u6d41\u884c\u7684 Java \u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE\uff09\uff0c\u4f46\u662f\u5b83\u672c\u8eab\u5e76\u4e0d\u80fd\u76f4\u63a5\u751f\u6210 exe \u6587\u4ef6\u3002\u76ee\u524d\uff0c\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u7b2c\u4e09\u65b9\u5de5\u5177\u6765\u5c06 Java \u5e94\u7528\u7a0b\u5e8f\u6253\u5305\u6210\u53ef\u6267\u884c\u6587\u4ef6\u3002\u672c\u6587\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528 IntelliJ IDEA \u751f\u6210 exe \u6587\u4ef6\u7684\u65b9\u6cd5\uff0c\u5e76\u8be6\u8ff0\u76f8\u5173\u539f\u7406\u3002<\/p>\n<p>1. \u539f\u7406<\/p>\n<p>Java \u7a0b\u5e8f\u9ed8\u8ba4\u662f\u4ee5 jar \u683c\u5f0f\u8fdb\u884c\u5206\u53d1\u548c\u8fd0\u884c\u7684\uff0c\u4f46\u662f\u5bf9\u4e8e\u8bb8\u591a\u7528\u6237\u800c\u8a00\uff0cexe \u683c\u5f0f\u7684\u53ef\u6267\u884c\u6587\u4ef6\u66f4\u52a0\u6613\u7528\u3002\u5c06 Java \u7a0b\u5e8f\u8f6c\u6362\u4e3a exe \u6587\u4ef6\u7684\u539f\u7406\u662f\u5229\u7528\u4e00\u4e2a exe \u542f\u52a8\u5668\uff08Launcher\uff09\uff0c\u5176\u5305\u542b\u5d4c\u5165\u7684 Java \u8fd0\u884c\u65f6\u73af\u5883\uff08JRE\uff09\uff0c\u5f53\u53cc\u51fb exe \u6587\u4ef6\u65f6\uff0c\u542f\u52a8\u5668\u5c06\u81ea\u52a8\u8fd0\u884c\u76f8\u5e94\u7684 Java \u7a0b\u5e8f\u3002\u8fd9\u6837\u4e00\u6765\uff0c\u6211\u4eec\u5b9e<a href=\"https:\/\/www.yimenexe.com\/ruanjian-kaifa-6382.html\">\u751f\u6210\u7684exe\u65e0\u6cd5\u542f\u52a8<\/a>\u9645\u4e0a\u8fd8\u662f\u5728\u8fd0\u884c Java \u7a0b\u5e8f\uff0c\u4f46\u5bf9\u7528\u6237\u800c\u8a00\uff0c\u8fd9\u4e2a\u8fc7\u7a0b\u662f\u900f\u660e\u7684\u3002<\/p>\n<p>2. \u51c6\u5907\u5de5\u4f5c<\/p>\n<p>\u4e3a\u4e86\u5c06 IntelliJ IDEA \u9879\u76ee\u8f6c\u6362\u4e3a exe \u6587\u4ef6\uff0c\u6211\u4eec\u9700\u8981\u786e\u4fdd\u5df2\u7ecf\u6b63\u786e\u5b89\u88c5\u4e86 JDK\u3002\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u5c06\u4f1a\u4f7f\u7528\u4e00\u4e2a\u6d41\u884c\u7684\u7b2c\u4e09\u65b9\u5de5\u5177 Launch4j \u6765\u5b9e\u73b0 Java \u7a0b\u5e8f\u5230 exe \u7684\u8f6c\u6362\u3002<\/p>\n<p>Launch4j \u662f\u4e00\u4e2a\u8de8\u5e73\u53f0\u7684\u5f00\u6e90\u5de5\u5177\uff0c\u53ef\u4ee5\u5c06 Java \u5e94\u7528\u7a0b\u5e8f\u6253\u5305\u6210 Windows \u53ef\u6267\u884c\u6587\u4ef6\u3002\u5b83\u53ef\u4ee5\u5c06 JRE \u5d4c\u5165\u5230 exe \u6587\u4ef6\u4e2d\uff0c\u4e3a\u7528\u6237\u63d0\u4f9b\u66f4\u597d\u7684\u4f53\u9a8c\u3002\u9996\u5148\uff0c\u4ece [Launch4j \u5b98\u7f51](http:\/\/launch4j.sourceforge.net\/) \u4e0b\u8f7d\u5e76\u5b89\u88c5\u8be5\u5de5\u5177\u3002<\/p>\n<p>3. \u7f16\u8bd1\u9879\u76ee\u5e76\u6253\u5305\u4e3a jar \u6587\u4ef6<\/p>\n<p>\u5728\u751f\u6210 exe \u6587\u4ef6\u4e4b\u524d\uff0c\u6211\u4eec\u9700\u8981\u5148\u628a\u9879\u76ee\u7f16\u8bd1\u5e76\u6253\u5305\u6210 jar \u6587\u4ef6\u3002\u4ee5\u4e0b\u4e3a\u5177\u4f53\u6b65\u9aa4\uff1a<\/p>\n<p>a. \u6253\u5f00 IntelliJ IDEA \u9879\u76ee\u3002<\/p>\n<p>b. \u4ece\u9876\u90e8\u83dc\u5355\u4e2d\u9009\u62e9 &#8220;File&#8221; -&gt; &#8220;Project Structure&#8221;\u3002<\/p>\n<p>c. \u5728 &#8220;Project Settings&#8221; \u9762\u677f\u4e2d\u9009\u62e9 &#8220;Artifacts&#8221; \u9009\u9879\u3002<\/p>\n<p>d. \u70b9\u51fb\u5de6\u4e0a\u89d2\u7684 &#8220;+&#8221; \u6309\u94ae\uff0c\u5e76\u9009\u62e9 &#8220;JAR&#8221; -&gt; &#8220;From modules with dependencies&#8221;\u3002<\/p>\n<p>e. \u5728 &#8220;Main Class&#8221; \u5b57\u6bb5\u4e2d\u9009\u62e9\u5e94\u7528\u7684\u4e3b\u7c7b\uff08\u5e26\u6709 main \u65b9\u6cd5\u7684\u7c7b\uff09\u3002<\/p>\n<p>f. \u786e\u8ba4\u8bbe\u7f6e\uff0c\u7136\u540e\u70b9\u51fb &#8220;OK&#8221; \u4ee5\u5173\u95ed &#8220;Project Structure&#8221; \u5bf9\u8bdd\u6846\u3002<\/p>\n<p>g. \u4ece\u9876\u90e8\u83dc\u5355\u4e2d\u9009\u62e9 &#8220;Build&#8221; -&gt; &#8220;Build Artifacts&#8221; -&gt; &#8220;Your_Jar_Name&#8221; -&gt; &#8220;Build&#8221;\u3002<\/p>\n<p>h. \u5982\u679c\u7f16\u8bd1\u6210\u529f\uff0c\u4f60\u5c06\u5728\u9879\u76ee\u7684 &#8220;out&#8221; \u76ee\u5f55\u7684 &#8220;artifacts&#8221; \u5b50\u76ee\u5f55\u4e2d\u627e\u5230\u751f\u6210\u7684 jar \u6587\u4ef6\u3002<\/p>\n<p>4. \u4f7f\u7528 Launch4j \u751f\u6210 exe \u6587\u4ef6<\/p>\n<p>a. \u6253\u5f00 Launch4j \u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n<p>b. \u5728 &#8220;Basic&#8221; \u6807\u7b7e\u9875\u7684 &#8220;Output file&#8221; \u4e2d\u9009\u62e9\u751f\u6210 exe \u6587\u4ef6\u7684\u8def\u5f84\u3002<\/p>\n<p>c. \u5728 &#8220;Jar&#8221; \u680f\u76ee\u4e2d\u9009\u62e9\u521a\u521a\u751f\u6210\u7684\u9879\u76ee jar \u6587\u4ef6\u3002<\/p>\n<p>d. \u5728 &#8220;Icon&#8221; \u4e2d\u9009\u62e9\u8981\u7528\u4e8e exe \u6587\u4ef6\u7684\u56fe\u6807\uff08\u53ef\u9009\u6b65\u9aa4\uff09\u3002<\/p>\n<p>e. \u5207\u6362\u5230 &#8220;JRE&#8221; \u6807\u7b7e\u9875\uff0c\u5e76\u8bbe\u7f6e\u6240\u9700\u7684 JRE \u7248\u672c\uff08\u5982\u679c\u9700\u8981\uff09\u3002<\/p>\n<p>f. \u4fdd\u5b58\u914d\u7f6e\u6587\u4ef6\uff0c\u4ee5\u4fbf\u65e5\u540e\u4f7f\u7528\uff1a\u70b9\u51fb &#8220;File&#8221; -&gt; &#8220;Save configuration&#8221;\u3002<\/p>\n<p>g. \u70b9\u51fb &#8220;Build wrapper&#8221; \u6309\u94ae\u5f00\u59cb\u751f\u6210 exe \u6587\u4ef6\u3002<\/p>\n<p>h. \u751f\u6210\u5b8c\u6210\u540e\uff0c\u5728 &#8220;Output file&#8221; \u4e2d\u6307\u5b9a\u7684\u8def\u5f84\u4e0b\uff0c\u4f60\u5c06\u627e\u5230 exe \u6587\u4ef6\u3002<\/p>\n<p>5.<\/p>\n<p><figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/i.cdn.yimenapp.com\/2023-03\/22\/18\/16413859517.jpg\" \/><\/figure>\n<\/p>\n<p> \u7ed3\u675f<\/p>\n<p>\u73b0\u5728\u4f60\u5df2\u7ecf\u751f\u6210\u4e86\u4e00\u4e2a\u53ef\u6267\u884c\u7684 exe \u6587\u4ef6\u3002\u5728\u542f\u52a8 exe \u6587\u4ef6\u540e\uff0c\u4f60\u7684 Java \u7a0b\u5e8f\u5c06\u6b63\u5e38\u8fd0\u884c\uff0c\u800c\u4f60\u4e0d\u9700\u8981\u62c5\u5fc3\u7528\u6237\u662f\u5426\u5b89\u88c5\u4e86\u6b63\u786e\u7248\u672c\u7684 JRE\u3002<\/p>\n<p>\u672c\u6587\u4e3a\u4f60\u63d0\u4f9b\u4e86\u4ece IntelliJ IDEA \u4e2d\u751f\u6210 exe \u6587\u4ef6\u7684\u539f\u7406\u4ee5\u53ca\u8be6\u7ec6\u7684\u64cd\u4f5c\u65b9\u6cd5\u3002\u901a\u8fc7\u4ee5\u4e0a\u4ecb\u7ecd\uff0c\u4f60\u53ef<a href=\"https:\/\/www.yimenexe.com\/exe-kaifa-1398.html\">windows\u5c01\u88c5exe\u8f6f\u4ef6<\/a>\u4ee5\u8f7b\u677e\u5c06 Java \u5e94\u7528\u7a0b\u5e8f\u6253\u5305\u6210\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u63d0\u4f9b\u7ed9\u7528\u6237\u66f4\u52a0\u4fbf\u6377\u7684\u4f7f\u7528\u4f53\u9a8c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Title: \u5229\u7528 IntelliJ IDEA \u751f\u6210\u53ef\u6267\u884c\u6587\u4ef6\uff08exe\uff09\u7684\u539f\u7406\u4e0e\u8be6\u7ec6\u4ecb\u7ecdIntelliJ IDEA \u662f\u4e00\u4e2a\u975e\u5e38\u6d41\u884c\u7684 Java \u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE\uff09\uff0c\u4f46\u662f\u5b83\u672c\u8eab\u5e76\u4e0d\u80fd\u76f4\u63a5\u751f\u6210 ex<\/p>\n","protected":false},"author":16,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[5217,5216,674,132,797],"topic":[],"class_list":["post-2502","post","type-post","status-publish","format-standard","hentry","category-kaifaexe","tag-ideaexe","tag-html5exe","tag-674","tag-132","tag-797"],"_links":{"self":[{"href":"https:\/\/app.60day.cn\/appday\/wp-json\/wp\/v2\/posts\/2502","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/app.60day.cn\/appday\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/app.60day.cn\/appday\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/app.60day.cn\/appday\/wp-json\/wp\/v2\/users\/16"}],"replies":[{"embeddable":true,"href":"https:\/\/app.60day.cn\/appday\/wp-json\/wp\/v2\/comments?post=2502"}],"version-history":[{"count":0,"href":"https:\/\/app.60day.cn\/appday\/wp-json\/wp\/v2\/posts\/2502\/revisions"}],"wp:attachment":[{"href":"https:\/\/app.60day.cn\/appday\/wp-json\/wp\/v2\/media?parent=2502"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/app.60day.cn\/appday\/wp-json\/wp\/v2\/categories?post=2502"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/app.60day.cn\/appday\/wp-json\/wp\/v2\/tags?post=2502"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/app.60day.cn\/appday\/wp-json\/wp\/v2\/topic?post=2502"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}