image courtesy - https://hub.docker.com/_/openjdk
Quick guide to download and install OpenJDK docker image.
OpenJDK is the short form of Open Java Development Kit similar to Oracle's Java Development Kit used to develop Java Applications. Main difference between Oracle JDK and OpenJDK is that OpenJDK is free for all while Oracle Java Development Kit or Oracle JDK requires commercial license. For more details refer openjdk vs oracle jdk
If you want to know more about OpenJDK, you can go through Open Java Development Kit Quick guide.
Note: To uninstall previously installed OpenJDK please refer Uninstall OpenJDK Windows
There are many OpenJDK vendors out there in the market ( here is the OpenJDK Vendors List ), you can download OpenJDK from AdoptOpenJDK, Redhat OpenJDK, Zulu OpenJDK or from Community OpenJDK.
Below are the steps to download and install Community OpenJDK. If you would like to install OpenJDK from other vendors please refer :
We can use the openjdk docker image as both the build and runtime environment. We can compile and run our project simply by adding below lines in the Docker file.
FROM openjdk:11 COPY . /usr/src/myapp WORKDIR /usr/src/myapp RUN javac Main.java CMD ["java", "Main"]
$ docker build -t my-java-app . $ docker run -it --rm --name my-running-app my-java-app
if you dont want to run your app inside a container and would like to compile your app, you can run the below commands:
$ docker run --rm -v "$PWD":/usr/src/myapp -w /usr/src/myapp openjdk:11 javac Main.java
This will add your current directory as a volume to the container, set the working directory to the volume, and run the command javac Main.java which will tell Java to compile the code in Main.java and output the Java class file to Main.class.
Congratulations !!! Now you have configured OpenJDK Docker image Successfully. For more info, please
refer OpenJDK Docker Image
Note: Here is the list of OpenJDK known-issues OpenJDK Known Issues
Here is the quick video tutorial that demonstrates how to Download and Install OpenJDK 16 on Windows 10.
Download OpenJDK - here are the OpenJDK versions you might be interested in!
OpenJDK 7 Download Windows 64 bit
OpenJDK 8 Download Windows 64 bit
OpenJDK 9 Download Windows 64 bit
OpenJDK 10 Download Windows 64 bit
OpenJDK 11 Download Windows 64 bit
OpenJDK 12 Download Windows 64 bit
If you are looking out for earlier OpenJDK versions, go to OpenJDK Archive