我正在尝试编译一个简单的模块,但是,我不断得到这个:
# javac -d mods/io.adenix.greet src/io.adenix.greet/module-info.java src/io.adenix.greet/io/adenix/greet/Main.java
$ mods/io.adenix.greet not found
我正在使用一个 Oracle Java 9u181 docker 镜像,我将它放在一起用于试用 Java 9,adenix/java:9u181。
项目结构
.
├── mods
│ └── io.adenix.greet
└── src
└── io.adenix.greet
├── io
│ └── adenix
│ └── greet
│ └── Main.java
└── module-info.java
模块信息.java
module io.adenix.greet { }
主.java
package io.adenix.greet;
public class Main {
public static void main(String[] args) {
System.out.println("Hello, world!");
}
}
更新 1
这是我的 Dockerfile,概述了我安装 Java 9u181 所采取的步骤
Dockerfile
FROM ubuntu:16.04
RUN \
apt update && \
apt install -y curl && \
curl -jkL -H "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/9+181/jdk-9_linux-x64_bin.tar.gz -o jdk-9_linux-x64_bin.tar.gz && \
apt remove -y curl && \
apt clean && \
apt -y autoremove && \
rm -rf /var/lib/apt/lists/* && \
tar xvzf jdk-9_linux-x64_bin.tar.gz -C /opt/ && \
rm -rf jdk-9_linux-x64_bin.tar.gz && \
update-alternatives --install /usr/bin/java java /opt/jdk-9/bin/java 100 && \
update-alternatives --install /usr/bin/javac java /opt/jdk-9/bin/javac 100 && \
update-alternatives --install /usr/bin/jshell jshell /opt/jdk-9/bin/jshell 100
CMD ["jshell"]
# If you're reading this and have any feedback on how this image could be
# improved, please open an issue or a pull request so we can discuss it!
#
# https://github.com/adenix/docker-java/issues