Setup Java like a Pro

Posted by ChenRiang on November 28, 2020

SDKMAN!

SDKMAN! (formerly known as GVM- Groovy enVironment Manager) is a tool for managing parallel versions of multiple SDK on Unix environment. It will become extreme handy when you need to test your Java application with different Java version and distribution.

Although I don’t need an environment with multiple Java version, but being a lazy developer, setting up java environment just too much work for me. too much

We are going to set up our development in WSL with:

  • Java 1.8
  • Maven 3.6.3

Install SDKMAN!

  1. Launch wsl terminal and execute following command to install SDKMAN!.

    1
    
     curl -s "https://get.sdkman.io" | bash
    
  2. Open a new terminal or refresh the terminal with following command.

    1
    
     source ~/.bashrc
    
  3. Check SDKMAN! version to validate.

    1
    
     sdk v
    

Install Java

  1. List all the available Java in SDKMAN!.
    1
    
     sdk l java
    

    List all available Java

  2. Install the Java. (In my case I will use 8.0.275.hs-adpt)
    1
    
     sdk i java 8.0.275.hs-adpt
    
  3. Done.

Install Maven

  1. List all the available Maven in SDKMAN!.
    1
    
     sdk l maven
    
  2. Install Maven.
    1
    
     sdk i maven 3.6.3
    
  3. Done.