问题
I have coded this Dockerfile that makes a runnable jar out of a project and it also builds but when i try to run it, it says "Error: Could not find or load Main class Main.Main"
Dockerfile:
RUN yum install -y java-1.8.0-openjdk.x86_64 java-1.8.0-openjdk-
devel.x86_64 && yum clean all
COPY resources /home/resources
COPY elk_casino_server /home/elk_casino_server
RUN /usr/bin/javac /home/elk_casino_server/src/Main/Main.java
RUN jar vcmf /home/elk_casino_server/src/META-INF/MANIFEST.MF
/home/elk_casino_server/src/server.jar
/home/elk_casino_server/src/Main/Main.class
/home/elk_casino_server/src/config.properties
CMD ["java","-jar","/home/elk_casino_server/src/server.jar"]
回答1:
Docker COPY
command accepts path as a second parameter. Try changing your Dockerfile
Dockerfile
...
COPY resources /home/
COPY elk_casino_server /home/
...
来源:https://stackoverflow.com/questions/54144292/docker-error-could-not-find-or-load-main-class-main-main