Red Hat ã®ã½ãªã¥ã¼ã·ã§ã³ã¢ã¼ããã¯ãã®ç¬æ¸ã§ãã
æ¦è¦
OpenJDK 14ããjpackageã¨ããã¤ã³ã¹ãã¼ã©ã¼ãä½ãããã®ãã¼ã«ãå梱ãããããã«ãªãã¾ããã ãã¨ãã¨ã¯JavaFXã«ãã£ãjavapackagerããã¼ã¹ã¨ãªã£ã¦ãããã¼ã«ã§ãã Windows/Linux/Macç¨ã®ã¤ã³ã¹ãã¼ã©ã¼ãä½æãããã¨ãã§ãã¾ãã
ãã¨ãã¨Java 8ã¾ã§ã¯Java Web Startçã§ã¢ããªã±ã¼ã·ã§ã³ã®é å¸ãè¡ã£ã¦ãã¾ããããã»ãã¥ãªãã£ä¸ã®çç±ã«ãããªãããããã¦ãã¾ã£ãã®ã§ãã¡ãã®ä»£æ¿ã¨ãªãã¢ããªã±ã¼ã·ã§ã³ã®é å¸æ¹æ³ã«ãªãã¾ãã
ãã¡ãã使ç¨ããã¨Javaã§ä½ãããã¢ããªã±ã¼ã·ã§ã³ã ãã§ãªããOpenJDK(Javaã®å®è¡ç°å¢)ãåæã«é å¸ã§ããããã±ã¼ã¸ãä½æã§ãã¾ãã ããã ãã§OpenJDKã®ã¤ã³ã¹ãã¼ã«ãã§ããã¢ããªã±ã¼ã·ã§ã³ãå®è¡ãããOpenJDKã®ãã¼ã¸ã§ã³ãåºå®ã§ããã®ã§ãã¯ã©ã¤ã¢ã³ãã¢ããªã±ã¼ã·ã§ã³ãä½ãããå ´åã¯ä¾¿å©ãªãã¼ã«ã§ãã
ä»åã¯ãã¡ãã使ç¨ãã¦ãWindowsåãã®é å¸ããã±ã¼ã¸(msi)ãä½ã£ã¦ããã¾ãã
ã¡ãªã¿ã«ãJEP 343: Packaging Tool ã§ææ¡ããã¦å®è£ ããã¾ããã openjdk.org
ãã¼ã«ã®ã¤ã³ã¹ãã¼ã«
OpenJDK
jpackageã¯OpenJDKã«å«ã¾ãããã¼ã«ãªã®ã§OpenJDKãã¤ã³ã¹ãã¼ã«ãã¾ãã ä»åã¯Red Hatããµãã¼ããã¦ããEclipse Temurinã使ç¨ãã¾ãã
Eclipse Temurinã®ä»¥ä¸ã®ãªãªã¼ã¹ã使ç¨ãã¾ããã
openjdk 21 2023-09-19 LTS OpenJDK Runtime Environment Temurin-21+35 (build 21+35-LTS) OpenJDK 64-Bit Server VM Temurin-21+35 (build 21+35-LTS, mixed mode, sharing)
jpackageã¯ã¤ã³ã¹ãã¼ã«å ã®binã®ä¸ã«å ¥ã£ã¦ãã¾ããbinã®ä¸ã«PATHãéã£ã¦ãããã¨ã確èªãã¦ãã ããã
WiX Toolset
WiX Toolset v3ãã¤ã³ã¹ãã¼ã«ããå¿ è¦ãããã¾ããv4ç³»ããªãªã¼ã¹ããã¦ãã¾ããããã¡ãã§ã¯åä½ãã¾ããã
WiX Toolset v3ã®ãã¦ã³ãã¼ãã¯githubããè¡ããã¨ãã§ãã¾ãã wix311-binaries.zipããã¦ã³ãã¼ããã¦PATHã®éã£ã¦ããå ´æã«è§£åãã¦ç½®ãã¦ããã®ãç°¡åã§ãã
WiXã®ã¤ã³ã¹ãã¼ã«ã«å¤±æãã¦ããå ´åã¯jpackageã®å®è¡æã«æ¬¡ã®ãããªã¡ãã»ã¼ã¸ã表示ããã¾ãã
[14:24:55.174] WiXãã¼ã«(light.exeãcandle.exe)ãè¦ã¤ããã¾ãã [14:24:55.174] WiX 3.0以éãhttps://wixtoolset.orgãããã¦ã³ãã¼ãããPATHã«è¿½å ãã¾ãã ã¨ã©ã¼: ç¡å¹ã¾ãã¯ãµãã¼ãããã¦ããªãã¿ã¤ã: [msi]
ä»å使ç¨ãããµã³ãã«
ä»å使ç¨ããã¢ããªã±ã¼ã·ã§ã³ã®ãµã³ãã«ã¯ä»¥ä¸ã«ä¿åãã¦ããã¾ããå ¥åãã¦ãããã©ã¡ã¼ã¿ã¼ã¨å®éã®ã½ã¼ã¹ã³ã¼ããæ¯ã¹ããå ´åã¯è¦ã¦ã¿ã¦ãã ããã
å®éã«ä½¿ç¨ãã¦ã¿ã
Javaã¢ããªã±ã¼ã·ã§ã³ã¯mavençã§ãã«ãããã¦ãjarãã¡ã¤ã«ãä½æãã¦ããã¾ããè¤æ°ã®jarãå«ãããã¨ãã§ãã¾ãã ä»åã®ãµã³ãã«ã®å ´åã¯ãmvn packageã§ãã«ãããããã¨ã§jarãã¡ã¤ã«ãä½æã§ãã¾ãã jarã®ä¸ã«ã¯èµ·åãããããã®mainã¡ã½ãããå«ã¾ãã¦ããå¿ è¦ãããã¾ãã
jpackage -hã§ä½¿ç¨ã§ãããªãã·ã§ã³ã®ä¸è¦§ã表示ããã¾ããæ¥æ¬èªåãããã¦ããã®ã§ã使ãåã«ä¸åº¦è¦ã¦ã¿ãã¨ããã§ãããã
ä»åã¯msiå½¢å¼ãä½ãã¾ãã
msiå½¢å¼ãä½ãå ´åãããã©ã«ãè¨å®ã§program filesé ä¸ã«ãµã¤ã¬ã³ãã¤ã³ã¹ãã¼ã«ãããããã±ã¼ã¸ãä½æããã¾ããããã ã¨ä½¿ãã«ããã®ã§ããã¤ãã®ã¤ã³ã¹ãã¼ã«æã®è¨å®ãå ãã¦å®è¡ãã¾ãã
C:\>jpackage --type msi --win-menu --win-dir-chooser --win-shortcut --win-shortcut-prompt --input .\clientexample\target --name clientexample --main-class com.redhat.clientexample.App --main-jar clientexample.jar
ããããã®ãªãã·ã§ã³ã®æå³ã¯æ¬¡ã®éãã§ãã
ãªãã·ã§ã³ | 説æ |
---|---|
type | ä½æããå½¢å¼(ä»åã¯msi) |
win-menu | Windowsã¡ãã¥ã¼ã«ç»é²ãã |
win-dir-chooser | ã¤ã³ã¹ãã¼ã«å ãé¸æã§ããããã«ãã |
win-shortcut | ã·ã§ã¼ãã«ãããä½æãã |
win-shortcut-prompt | ã·ã§ã¼ãã«ãããä½æãããã©ããããã³ããã表示ãã |
input | ã¢ããªã±ã¼ã·ã§ã³ã«å«ãããã©ã«ã |
name | ã¢ããªã±ã¼ã·ã§ã³ã®åå |
main-class | èµ·åããmainã¡ã½ããã®å«ã¾ãã¦ããã¯ã©ã¹ |
main-jar | èµ·åããjar |
inputã§ããã±ã¼ã¸åãããã©ã«ããæå®ãã¦ãã(=jar以å¤ãå«ãããã¨ãã§ãã)ã¨ããã®ããã¤ã³ãã§ããããã 詳細ã«ã¤ãã¦ã¯jpackage -hãåç §ãã¦ãã ããã
å®è¡ããã¨ãä½äºããªãã£ãããã«çµäºããmsiããã±ã¼ã¸ãä½æããã¾ãã
msiãèµ·åããã¨ã»ããã¢ããã¦ã£ã¶ã¼ããèµ·åãã¾ããæ®éã®Windowsã¤ã³ã¹ãã¼ã©ã¼ã§ããã
ã¤ã³ã¹ãã¼ã«å ãå¤æ´ãããã¨ãã§ãã¾ãã
ã·ã§ã¼ãã«ããã®ä½æãé¸æãããã¨ãã§ãã¾ãã
æå®ããã¨ã¤ã³ã¹ãã¼ã«ãéå§ã§ãã¾ãã
ã¹ã¿ã¼ãã¡ãã¥ã¼ã«ã·ã§ã¼ãã«ããã追å ãããé¸æãã¦ããã®ã§ãã·ã§ã¼ãã«ãããä½æããã¦ãã¾ããä¸è¬çãªWindowsã¢ããªã±ã¼ã·ã§ã³ã®ã¤ã³ã¹ãã¼ã«ã¨å¤ããããã¾ããã
ãã¹ã¯ãããã«ã·ã§ã¼ãã«ãããä½æãããã¨ãé¸æãã¦ããã®ã§ããã¹ã¯ãããã«ã·ã§ã¼ãã«ãããä½æããã¦ãã¾ãããã¡ããä¸è¬çãªWindowsã¢ããªã±ã¼ã·ã§ã³ã®ã¤ã³ã¹ãã¼ã«ã¨å¤ããããã¾ããã ãªã³ã¯å ã¯Windowsã®å®è¡ãã¡ã¤ã«(exe)ã«ãªã£ã¦ãã¾ããjarã¸ãªã³ã¯ãå¼µããã¦ããããã§ã¯ããã¾ããã
å®è¡ããã¨æ®éã«èµ·åãã¾ããæ®éã«ã¨ããè¨ãã¾ããã
ã¤ã³ã¹ãã¼ã«ããã¢ããªã±ã¼ã·ã§ã³ã®ãã©ã«ããè¦ãã¨ãexeãã¡ã¤ã«ãä¸ã¤ã¨ãappã¨runtimeã¨ãããã©ã«ããè¦ã¤ãããã¨ãã§ãã¾ãã ã·ã§ã¼ãã«ããããã¯ãã¡ãã®exeã«ãªã³ã¯ãå¼µããã¦ãã¾ãã
appã®ä¸ã«ã¯inputã§æå®ãããã©ã«ãã®é ä¸ã®ãã¡ã¤ã«ã¨ãããã¤ãã®ã¡ã¿ãã¼ã¿ãçæããã¦å ¥ã£ã¦ãã¾ããä»åã¯mavenãã«ãã®ææç©ããã®ã¾ã¾ä½¿ç¨ãã¦ããããä½åãªãã¡ã¤ã«ãå«ã¾ãã¦ãã¾ãã å®éã«é å¸ããå ´åã¯é å¸ç¨ã®ãã©ã«ãæ§æãå¥éç¨æãã¦ããã¤ã³ã¹ãã¼ã©ã¼ãä½æãããã¨ã§é å¸ç©ã®ãµã¤ãºãæãããã¨ãã§ãã¾ãã
runtimeã®ä¸ã«ã¯OpenJDKããå¿ è¦ãªãã®ã®ã¿ãé ç½®ããã¦ãã¾ããããã©ã«ãã§ã¯éçºãã¼ã«é¡ã¯å ¥ã£ã¦ãã¾ããã OpenJDKç±æ¥ã®ãã¡ã¤ã«ã«ã¤ãã¦ã¯jlinkã使ç¨ãã¦æºåããã¾ããé å¸ãã¡ã¤ã«ã®ãµã¤ãºãå°ãããããå ´åã¯jlinkã«ãªãã·ã§ã³ã渡ããã¨ã§å®ç¾ã§ãã¾ãã
ã¾ã¨ã
ãã¤ã¦ã®Javaã¢ããªã±ã¼ã·ã§ã³ã¯ã©ã³ã¿ã¤ã ã¨ã¦ã¼ã¶ã¼ã¢ããªã±ã¼ã·ã§ã³ã®é å¸ã¿ã¤ãã³ã°ãç°ãªã£ã¦ãããããè¤æ°ã®Javaãã¼ã¸ã§ã³ãæ··å¨ããããã¨ãé£ãããã©ã³ã¿ã¤ã ã®ãã¼ã¸ã§ã³ã¢ããæã«èæ ®ããå¿ è¦ãããã¾ããã ç¾å¨ã§ã¯ã¢ããªã±ã¼ã·ã§ã³ã¨åæã«ã©ã³ã¿ã¤ã ãé å¸ããæ¹å¼ããµãã¼ãããã¦ããããã管çããããããªã£ã¦ãã¾ãã Windows/Mac/Linuxã§åãããã«åä½ãããã¹ã¯ãããã¢ããªã±ã¼ã·ã§ã³ãå¿ è¦ãªå ´åã¯ç¾å¨ã§ãæå¹ãªé¸æè¢ã®ä¸ã¤ã§ãã®ã§ããã²ã試ããã ããã
追è¨:
åã«jpackageã®ãã°ãç´ããã¨ããèªåã®ãã¹ã¯ãããæ±ããããªããã©ã©ããã£ã¦ã¤ã³ã¹ãã¼ã©ã¼è©¦ããï¼ãã¨æ©ãã ãã©Windows Sandboxã«å©ãããããjpackageã®ã¤ã³ã¹ãã¼ã©ã¼ã®ãã¹ããããæ¹ããã²Sandboxã®åå¨ãæãåºãã¦ã»ããã https://t.co/xEhOddQuvY
— Yasumasa Suenaga (@YaSuenag) 2023å¹´10æ25æ¥
ç¥ããªãã£ãã»ã»ã»ã» learn.microsoft.com
ç¶ããæ¸ãã¾ããã