lang="en-US"> Exploring Java 10 using Docker - Knoldus Blogs
Knoldus Blogs

Exploring Java 10 using Docker

Reading Time: 3 minutes

On March 20, 2018, Java 10 was released and everybody wants to explore Java 10 but not everyone wants to change their development environment.

Java 10

So in this blog, we will be discussing how can we use Java 10 using Docker.

This can be done by following simple steps given below:

  1. Firstly, you need to install Docker. You can install Docker from the official site of Docker.
  2. Open terminal.
  3. Create a directory jdk10docker and move into that directory.
  4. Make a java class JdkTen.
  5. Add the following code in your java class file.
  6. Make a text file with the name Dockerfile.
  7. Copy following code in the Dockerfile.
  8. Build docker image. It may take some time to download.

    Which should result in the following output:

  9. Check for all the available docker images in your system using the following command:

    And you will be able to see all the available images on your system.

  10. Run your explorejava image by using image id corresponding it.

    Resulting in the following output

  11. Now open a new tab and check for available containers using the following command. Make sure you are in your jdk10docker directory.

    Which will result in an output like this

  12. Now execute the container with the corresponding container id.

And Java 10 is ready to use.
You can simply compile and run your java class or you can use Java REPL just by typing jshell.

For instance,

Hope you liked the blog. Thanks for reading!

References:
docs.docker.com
docs.oracle.com



Exit mobile version