简体   繁体   中英

Docker Error: Could not find or load Main class Main.Main

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"]

Docker COPY command accepts path as a second parameter. Try changing your Dockerfile

Dockerfile

...
COPY resources /home/
COPY elk_casino_server /home/
...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM