Skip to main content

Java

This guide covers setting up Java development with JDK and Maven.

Installation

We recommend using Amazon Corretto 17, a production-ready distribution of OpenJDK.

# Using winget
winget install Amazon.Corretto.17.JDK

# Or using Chocolatey
choco install corretto17jdk

# Set environment variables (run as Administrator)
[System.Environment]::SetEnvironmentVariable("JAVA_HOME", "C:\Program Files\Amazon Corretto\jdk17", "Machine")
$env:Path += ";$env:JAVA_HOME\bin"

Or download the installer from Amazon Corretto 17.

Verify Installation

java -version

Maven

Maven is a build and project management tool primarily used for Java projects. It simplifies dependency management, compilation, testing, and packaging.

Install Maven

# Using winget
winget install Apache.Maven

# Or using Chocolatey
choco install maven

# Set environment variables (run as Administrator)
[System.Environment]::SetEnvironmentVariable("M2_HOME", "C:\Program Files\Apache\maven", "Machine")
$env:Path += ";$env:M2_HOME\bin"

Or download from Maven Downloads and extract to your preferred location.

Verify Installation

mvn -version

Common Maven Commands

# Build project, run tests, create artifacts
mvn package

# Build and install to local repository
mvn install

# Clean build directories
mvn clean

# Run all together
mvn clean install

Set Up Maven with JFrog

  1. Go to https://p6m.jfrog.io
  2. Login
  3. Navigate to Profile → Set Me Up → Maven
  4. Click Generate Token and Create Instructions
  5. Click Generate Settings and download the snippet
  6. Move settings.xml to your Maven configuration directory (~/.m2/settings.xml or %USERPROFILE%\.m2\settings.xml on Windows)