我有 Gentoo Docker 镜像。我正尝试在容器内安装 Java 8。网上有一些教程,但它们没有帮助。
我尝试运行:
emerge --verbose dev-java/icedtea-bin:8
但得到了这个输出:
The following USE changes are necessary to proceed:
(see "package.use" in the portage(5) man page for more details)
# required by net-print/cups-filters-1.21.6::gentoo[postscript]
# required by net-print/cups-2.2.7::gentoo
# required by dev-java/icedtea-bin-3.10.0-r1::gentoo[cups,-multilib]
# required by virtual/jdk-1.8.0-r3::gentoo
# required by virtual/jre-1.8.0-r1::gentoo
# required by dev-java/icedtea-web-1.6.2::gentoo
>=app-text/ghostscript-gpl-9.26 cups
Use --autounmask-write to write changes to config files (honoring
CONFIG_PROTECT). Carefully examine the list of proposed changes,
paying special attention to mask or keyword changes that may expose
experimental or unstable packages.
答案1
可以通过下载 tar.gz 存档来安装它,如下所示:
...
RUN wget -c --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz \
&& mkdir /opt/jdk \
&& tar zxf jdk-8u131-linux-x64.tar.gz -C /opt/jdk \
&& update-alternatives --install /usr/bin/java java /opt/jdk/jdk1.8.0_131/bin/java 100 \
&& update-alternatives --install /usr/bin/javac javac /opt/jdk/jdk1.8.0_131/bin/javac 100 \
&& update-alternatives --display java \
&& update-alternatives --display javac \
&& rm -rf jdk-8u131-linux-x64.tar.gz
...
答案2
运行 wget -c --header "Cookie: oraclelicense=accept-securebackup-cookie"http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz 运行 mkdir /opt/jdk 运行 tar zxf jdk-8u131-linux-x64.tar.gz -C /opt/jdk ENV PATH=$PATH:/opt/jdk/jdk1.8.0_131/bin