Compiling and running java with external libraries in dockerfile

I am struggling to compile and run a java file using docker. I have the file structure:

./Repo/
   Dockerfile
   ./libs/
      org.json.jar
   ./out/
      Program.class
   ./src/
      Program.java

My Dockerfile looks something like this:

FROM java:8-jdk-alpine

COPY /src /src/
COPY /out /out/
COPY /libs /libs/

RUN javac ..
CMD java ..

I want to be able to compile the files in src and output them in out whilst using the external libs
The only way I have managed to do this is to first CD into /src/ and run the following:

javac -d ../out -cp ../libs/org.json.jar Program.java

But surely there is a way to do this from the directory that the Dockerfile is in like?

javac -d /out -cp /libs/org.json.jar /out/Program.java

The next issue is the CMD required to run the above program. I’m not sure how to write this.

Or should I copy the json lib to the out folder where the compiled program is and run the following CMD:

java -cp "org.json.jar;" Server

Source: StackOverflow