I have a java file inside JavaFile
directory from the below screenshot and want to run that java file from other directory (i.e) from
C:\Priyanka\Docker-AppCodes\java-docker-app
My java file is present inside the JavaFile Folder. How should I run the java
file. I am using the command
RUN javac JavaFile/Hello.java
to run in DockerFile. My Java
File Hello.java
contains the below code.
class Hello{
public static void main(String[] args){
System.out.println("This is java app \n by using Docker");
}
}
But I am receiving the File not Found Error. Please help me to resolve this.
The Docker file contains the below code:
FROM java:8
COPY . /var/www/java
WORKDIR /var/www/java
RUN javac JavaFile/Hello.java
CMD ["java", "Hello"]