Linked Questions

Popular Questions

I have a java program that I wrote. The main things include OpenJDK8, Maven, and JavaFX. The program builds and runs on its own. I want to put it in a Docker container, but I'm having trouble getting it to build.

Here is my Dockerfile:

FROM openjdk:8-jdk
FROM maven:3.3-jdk-8-onbuild
RUN apt-get update && apt-get install -y --no-install-recommends openjfx && rm -rf /var/lib/apt/lists/*
CMD ["java","-jar","target/"CodeDemo-1.0-SNAPSHOT.jar"]

Here is what I ran to build the container:

sudo docker build -t java-maven-code-demo .

Here is the error I keep getting complaining about no javafxpackager:

Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (unpack-dependencies) on project CodeDemo: Command execution failed. Cannot run program "/usr/lib/jvm/java-8-openjdk-amd64/jre/../bin/javafxpackager" (in directory "/usr/src/app"): error=2, No such file or directory -> [Help 1]

I have all the files in a CodeDemo directory. At the top level, I have src, target, Dockerfile, pom.xml. In target, I have the compiled jar.

I'm confused by the error because I thought Java 8 OpenJDK came with JavaFX. So, if I'm pulling OpenJDK, I should be gettng the things I need for JavaFX (similar question on GitHub - solution still gave the error though).

Can anyone point me in the direction of what I could be doing wrong? Is there something else I should be doing to get the proper libraries?

Related Questions