{"id":25513,"date":"2024-05-13T12:18:07","date_gmt":"2024-05-13T04:18:07","guid":{"rendered":"https:\/\/www.zhidianwl.net\/zhidianwl\/?p=25513"},"modified":"2024-05-13T12:18:07","modified_gmt":"2024-05-13T04:18:07","slug":"java%e6%89%93%e5%8c%85exe%e4%b9%8b%e5%90%8e%e4%b9%b1%e7%a0%81%e6%98%af%e4%bb%80%e4%b9%88%e5%8e%9f%e5%9b%a0","status":"publish","type":"post","link":"https:\/\/www.zhidianwl.net\/zhidianwl\/2024\/05\/13\/java%e6%89%93%e5%8c%85exe%e4%b9%8b%e5%90%8e%e4%b9%b1%e7%a0%81%e6%98%af%e4%bb%80%e4%b9%88%e5%8e%9f%e5%9b%a0\/","title":{"rendered":"java\u6253\u5305exe\u4e4b\u540e\u4e71\u7801\u662f\u4ec0\u4e48\u539f\u56e0?"},"content":{"rendered":"
Java \u6253\u5305\u6210 EXE \u6587\u4ef6\u540e\u51fa\u73b0\u4e71\u7801\u7684\u95ee\u9898\uff0c\u901a\u5e38\u662f\u7531\u4e8e\u5b57\u7b26\u7f16\u7801\u4e0d\u4e00\u81f4\u5bfc\u81f4\u7684\u3002\u5728\u5f00\u53d1 Java \u7a0b\u5e8f\u65f6\uff0c\u6211\u4eec\u901a\u5e38\u4f7f\u7528 UTF-8 \u7f16\u7801\uff0c\u56e0\u4e3a\u5b83\u5177\u6709\u66f4\u5e7f\u6cdb\u7684\u53ef\u8bfb\u6027\u548c\u5bf9\u7279\u6b8a\u5b57\u7b26\u7684\u652f\u6301\u3002\u7136\u800c\uff0c\u5728 Wexe\u6587\u4ef6\u6346\u7ed1<\/a>indows \u64cd\u4f5c\u7cfb\u7edf\u4e2d\uff0c\u6267\u884c EXE \u6587\u4ef6\u7684\u9ed8\u8ba4\u7f16\u7801\u4e0e UTF-8 \u7f16\u7801\u5e76\u4e0d\u5b8c\u5168\u517c\u5bb9\uff0c\u56e0\u6b64\u5728\u6253\u5305\u6210 EXE \u6587\u4ef6\u540e\u53ef\u80fd\u5bfc\u81f4\u90e8\u5206\u4e2d\u6587\u5b57\u7b26\u663e\u793a\u4e3a\u4e71\u7801\u3002\u63a5\u4e0b\u6765\u4e3b\u8981\u4ece\u4ee5\u4e0b\u51e0\u4e2a\u65b9\u9762\u6765\u8fdb\u884c\u539f\u7406\u89e3\u6790\u53ca\u89e3\u51b3\u65b9\u6848\u7684\u8be6\u7ec6\u4ecb\u7ecd\u3002<\/p>\n 1. \u5b57\u7b26\u7f16\u7801\u7684\u539f\u7406:<\/p>\n \u5b57\u7b26\u7f16\u7801\u662f\u5b57\u7b26\u96c6\u5230\u5b57\u8282\u7801\u7684\u6620\u5c04\u65b9\u5f0f\u3002Java \u4e2d\u7684\u5b57\u7b26\u662f Unicode \u7f16\u7801\uff0c\u4ee5\u4fbf\u652f\u6301\u591a\u79cd\u56fd\u9645\u8bed\u8a00\u3002\u7136\u800c Unicode \u7f16\u7801\u975e\u5e38\u5e9e\u5927\uff0c\u6db5\u76d6\u4e86\u8bb8\u591a\u5b57\u7b26\uff0c\u56e0\u6b64\u5728\u5b9e\u9645\u6587\u4ef6\u5b58\u50a8\u6216\u7f51\u7edc\u4f20\u8f93\u65f6\uff0c\u9700\u8981\u9009\u7528\u67d0\u79cd\u538b\u7f29\u7f16\u7801\uff0c\u4f8b\u5982 UTF-8\u3002\u7f16\u7801\u65b9\u5f0f\u591a\u79cd\u591a\u6837\uff0c\u5bfc\u81f4\u5728\u5904\u7406\u7279\u5b9a\u7f16\u7801\u7684\u5b57\u7b26\u4e32\u65f6\uff0c\u5982\u679c\u7a0b\u5e8f\u65e0\u6cd5\u8bc6\u522b\u6216\u8005\u4f7f\u7528\u9519\u8bef\u7684\u7f16\u7801\uff0c\u5c31\u4f1a\u5bfc\u81f4\u4e71\u7801\u95ee\u9898\u3002<\/p>\n 2. \u6253\u5305\u6210 EXE \u6587\u4ef6:<\/p>\n Java \u7a0b\u5e8f\u901a\u5e38\u6253\u5305\u6210 JAR \u6587\u4ef6\uff0c\u4f46\u662f\u5728 Windows \u7cfb\u7edf\u4e0b\uff0c\u4e3a\u4e86\u65b9\u4fbf\u7528\u6237\u76f4\u63a5\u53cc\u51fb\u8fd0\u884c\uff0c\u53ef\u80fd\u9700\u8981\u5c06 JAR \u6587\u4ef6\u8f6c\u6362\u6210 EXE \u6587\u4ef6\u3002\u5e38\u7528\u7684\u6253\u5305\u5de5\u5177\u5982 Launch4j\u3001exe4j \u7b49\uff0c\u53ef\u4ee5\u5c06 JAR \u6587\u4ef6\u4e0e Java \u8fd0\u884c\u73af\u5883\u4e00\u8d77\u6253\u5305\u6210\u5355\u4e2a\u7684 EXE \u6587\u4ef6\u3002<\/p>\n 3. \u95ee\u9898\u51fa\u73b0:<\/p>\n \u5f53\u4f7f\u7528\u9ed8\u8ba4\u8bbe\u7f6e\u6253\u5305\u6210 EXE \u6587\u4ef6\u65f6\uff0cWindows \u7cfb\u7edf\u4f7f\u7528\u7684\u662f ANSI \u7f16\u7801\uff0c\u800c Java \u7a0b\u5e8f\u4f7f\u7528\u7684\u662f UTF-8 \u7f16\u7801\u3002\u5f53\u7a0b\u5e8f\u8fd0\u884c\u5e76\u5904\u7406\u67d0\u4e9b\u9700\u8981\u663e\u793a\u7684\u4e2d\u6587\u5b57\u7b26\u65f6\uff0c\u7531\u4e8e\u7f16\u7801\u65b9\u5f0f\u4e0d\u4e00\u81f4\uff0c\u5bfc\u81f4\u8fd9\u4e9b\u7279\u6b8a\u5b57\u7b26\u65e0\u6cd5\u6b63\u786e\u5730\u6620\u5c04\u5230\u5185\u5b58\u4e2d\u7528\u4e8e\u5b58\u50a8\u6587\u672c\u7684\u4ee3\u7801\u5355\u5143\uff0c\u4ece\u800c\u8868\u73b0\u4e3a\u4e71\u7801\u3002<\/p>\n 4. \u89e3\u51b3\u65b9\u6848:<\/p>\n \u4e3a\u4e86\u89e3\u51b3\u6253\u5305\u6210 EXE \u6587\u4ef6\u540e\u7684<\/p>\n \u4e71\u7801\u95ee\u9898\uff0c\u53ef\u4ee5\u4ece\u4ee5\u4e0b\u51e0\u4e2a\u65b9\u9762\u5c1d\u8bd5\u89e3\u51b3\uff1a<\/p>\n a. \u4fee\u6539\u7a0b\u5e8f\u7684\u5b57\u7b26\u7f16\u7801\u8bbe\u7f6e:<\/p>\n \u5728\u7a0b\u5e8f\u4e2d\uff0c\u53ef\u4ee5\u5c06\u6d89\u53ca\u4e2d\u6587\u5b57\u7b26\u7684\u6240\u6709\u5b57\u7b26\u4e32\u90fd\u4f7f\u7528 UTF-8 \u7f16\u7801\u8fdb\u884c\u5904\u7406\u3002\u4f8b\u5982\uff0c\u5728\u8bfb\u53d6\u6587\u4ef6\uff0c\u7f51\u7edc\u4f20\u8f93\u7b49\u64cd\u4f5c\u6d89\u53ca\u7f16\u7801\u7684\u573a\u5408\uff0c\u90fd\u663e\u5f0f\u5730\u6307\u5b9a\u4f7f\u7528 UTF-8 \u7f16\u7801\u3002<\/p>\n b. \u4fee\u6539\u6253\u5305\u5de5\u5177\u7684\u8bbe\u7f6e:<\/p>\n \u5728\u6253\u5305 EXE \u6587\u4ef6\u65f6\uff0c\u53ef\u4ee5\u5c1d\u8bd5\u4fee\u6539\u6253\u5305\u5de5\u5177\u7684\u8bbe\u7f6e\uff0c\u5728\u914d\u7f6e\u6587\u4ef6\u6216\u9009\u9879\u4e2d\u6307\u5b9a\u4f7f\u7528 UTF-8 \u7f16\u7801\uff0c\u4ee5\u786e\u4fdd EXE \u6587\u4ef6\u5185\u90e8\u7684\u8d44\u6e90\u6587\u4ef6\u4e5f\u4f7f\u7528\u540c\u6837\u7684\u7f16\u7801\u65b9\u5f0f\u6765\u8bfb\u53d6\u3002<\/p>\n c. \u4fee\u6539 Windows \u7cfb\u7edf\u7684\u9ed8\u8ba4\u7f16\u7801:<\/p>\n<\/figure>\n<\/p>\n