====== jlink による容量の削減・最適化 ====== Java 9 から新機能 Project Jigsaw でモジュール機能が追加されました。\\ これを用いて MA-E3xx の Java SE Embedded 8 でインストールしていたのに相当する JRE を作成します。 [[https://docs.oracle.com/en/java/javase/11/migrate/index.html#JSMIG-GUID-34AA66E0-EC34-4155-A4AC-03AD3E6BC1FA|Oracle JDK Migration Guide - Removed Tools Support for Compact Profiles]] より、各 compact profile に指定されたモジュールは下記のとおりとなります。 |< 30em 10em 10em 10em >| ^ compact1 ^ compact2 ^ compact3 | | java.base | ⇐ | ⇐ | | java.logging | ⇐ | ⇐ | | java.scripting | ⇐ | ⇐ | | | java.rmi | ⇐ | | | java.sql | ⇐ | | | java.xml | ⇐ | | | | java.compiler | | | | java.instrument | | | | java.management | | | | java.naming | | | | java.prefs | | | | java.security.jgss | | | | java.security.sasl | | | | java.sql.rowset | | | | java.xml.crypto | \\ compact3 相当((vm=server で作成していますが、client のほうが良いかもしれません、お好みで))を作成してみます。 bionic64:~/src/openjdk-jdk11u$ jlink --vm=server --output ../jre11_compact3 --module-path build/linux-arm-normal-clientANDserverANDminimal-release/images/jdk/jmods \ --strip-debug --add-modules java.base,java.logging,java.scripting,java.rmi,java.sql,java.xml,java.compiler,java.instrument,java.management,java.naming,java.prefs,java.security.jgss,java.security.sasl,java.sql.rowset,java.xml.crypto \ --no-header-files --no-man-pages \\ ''--output'' で指定したディレクトリに最適化された JRE が作成されます。 bionic64:~/src/openjdk-jdk11u$ ls -ln ../jre11_compact3 合計 20 drwxrwxr-x 2 1000 1000 4096 12月 27 09:41 bin drwxrwxr-x 3 1000 1000 4096 12月 27 09:41 conf drwxrwxr-x 18 1000 1000 4096 12月 27 09:41 legal drwxrwxr-x 5 1000 1000 4096 12月 27 09:41 lib -rw-rw-r-- 1 1000 1000 256 12月 27 09:41 release bionic64:~/src/openjdk-jdk11u$ du ../jre11_compact3 16 ../jre11_compact3/conf/security/policy/limited 12 ../jre11_compact3/conf/security/policy/unlimited 36 ../jre11_compact3/conf/security/policy 88 ../jre11_compact3/conf/security 104 ../jre11_compact3/conf 60 ../jre11_compact3/bin 4 ../jre11_compact3/legal/java.scripting 48 ../jre11_compact3/legal/java.xml 76 ../jre11_compact3/legal/java.base 4 ../jre11_compact3/legal/java.management 4 ../jre11_compact3/legal/java.compiler 4 ../jre11_compact3/legal/java.transaction.xa 4 ../jre11_compact3/legal/java.security.jgss 4 ../jre11_compact3/legal/java.instrument 4 ../jre11_compact3/legal/java.sql.rowset 4 ../jre11_compact3/legal/java.rmi 16 ../jre11_compact3/legal/java.xml.crypto 4 ../jre11_compact3/legal/java.logging 4 ../jre11_compact3/legal/java.naming 4 ../jre11_compact3/legal/java.prefs 4 ../jre11_compact3/legal/java.sql 4 ../jre11_compact3/legal/java.security.sasl 196 ../jre11_compact3/legal 11804 ../jre11_compact3/lib/server 64 ../jre11_compact3/lib/jli 356 ../jre11_compact3/lib/security 46612 ../jre11_compact3/lib 46980 ../jre11_compact3 \\ これを MA-E3xx 実機に転送して実行してみます。 user1@plum:/tmp$ jre11_compact3/bin/java -version openjdk version "11.0.1" 2018-10-16 OpenJDK Runtime Environment (build 11.0.1+13-centurysys-1-MAE3xx) OpenJDK Server VM (build 11.0.1+13-centurysys-1-MAE3xx, mixed mode) Java 11 が動作するところまで確認できました。 \\