How to build Dockerfile with two jar files

I’m starting with Docker and I’m a little bit lost.

I have my java experiment with two jar files, zip files with testing data and two configuration files.
And I’m trying to run this exp on Docker.

  • dokku - Run Rails 4 app from Subfolder
  • Changing the default command of base docker images
  • what are the different between LXD,LXC and User mode linux?
  • Is this normal for docker?
  • Should Fig be on inside of Vagrant VM or outside for OSX?
  • Docker Swarm - balance resources (CPU, RAM) within scaled concurrent apps/services
  • If I want to run this exp on my pc there are two phases.

    Phase 1:

    java -classpath library.jar;alg.jar library.utl.App.class

    where the last parameter is configuration and after this I’ll get generated file alg1.bin

    Phase 2:

    java -classpath library.jar;alg.jar library.utl.App.class

    where I’m working with file alg1.bin and this is main test.

    I used Dockerfile for phase 1:

    FROM java:7
    ADD java-exp /usr/local/
    CMD ["java", "-classpath",
    "/usr/local/library.utl.App.class", "/usr/local/"]

    This I built successfully but when I try

    docker run java-exp

    I get an error:

    Error: Could not find or load main class

    Can anyone help me to solve this?

    In the better way, help me merge both two phases into one Dockerfile?

  • Any conflicts using Docker Toolbox for Mac and Already-Installed Virtualbox?
  • How to get my docker centos sshd passwordless server running?
  • docker build stopped at 67c44324f4e3: Downloading 8.633 MB
  • How to sync code between container and host using docker-compose?
  • Dockerized Django On Ubuntu
  • Docker tomcat not accessible from browser
  • 2 Solutions collect form web for “How to build Dockerfile with two jar files”


    FROM java:7
    ADD java-exp /usr/local/
    WORKDIR /usr/local/
    CMD ["java", "-classpath","library.jar;alg.jar","library.utl.App.class",""]

    I think I solved it.
    Main mistake was in CMD

    The right thing is:

    CMD ["java", "-classpath",
    "/usr/local/library.utl.App", "/usr/local/"]

    Instead of:

    CMD ["java", "-classpath",
    "/usr/local/library.utl.App.class", "/usr/local/"]

    Two little mistakes :,; and .class

    Thanks for help.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.