logoNEURAL COOK
SearchAll PostsTagsNotesAuthor
logoNEURAL COOK

A posts created with Next.js and Tailwind.css

Explore

  • All posts
  • Notes
  • Snippets
  • Tags
  • RSS feed

Connect

instagramtwitterfacebookyoutubelinkedinmailgithub

© 2026 VIKI. All rights reserved.

Built with
Contents
Java/JVM architectureJava Collections : A Complete Guide for DSAJava Object Anatomy: What lives in Memory?The Java Dev Environment That Just WorksJava Utility MethodUnderstanding the Servlet Ecosystem: From Tomcat to Micronaut
DNSHTTPIP AddressThe Comprehensive DNS Master Guide: Architecture, Protocol, and GovernanceThe OSI Reference Model: A Comprehensive GuideThe TCP/IP Stack: The Architecture of the Internet
LogsExamplesResources
Miscellaneous/java

The Java Dev Environment That Just Works

2 min read
On this pageWhat We Want
What We WantThe Big PictureInstall the BasicsToolsEnvironment Variables with dotenvLock Java & Maven Versions SDKMANAutomatic Environment Loading direnvStandard Commands with taskLefthook and EditorConfigKey FilesWhy This Works

Setting up a Java project shouldn’t take hours, involve outdated wikis, or require tribal knowledge.

This setup gives you a development environment that works the moment you clone the repo — no guesswork, no manual installs, no surprises.

# What We Want

  • Same Java and Maven versions
  • Same environment variables
  • Same commands

Clone → setup → start coding

# The Big Picture

# Install the Basics

=== "macOS" bash brew install direnv go-task

=== "Linux (Debian/Ubuntu)" bash sudo apt update sudo apt install direnv sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d

Install SDKMAN:

curl -s "https://get.sdkman.io" | bash
source "$HOME/.sdkman/bin/sdkman-init.sh"

# Tools

# Environment Variables with dotenv

We separate config from code:

  • .env.shared → team-wide config
  • .env → local secrets
DATABASE_PASSWORD=supersecret
STRIPE_API_KEY=pk_test_123
MICRONAUT_ENVIRONMENTS=dev

# Lock Java & Maven Versions SDKMAN

It ensures that every developer is using the exact same version of Maven and the JDK, which is the core of your Java work.

java=21.0.2-open
maven=3.9.6
sdk env install
sdk env

# Automatic Environment Loading direnv

It watches your terminal. As soon as you cd into your project, it executes the .envrc file. This loads the devenv shell and any environment variables into your current terminal session.

dotenv .env.shared
 
if [ -f .env ]; then
  dotenv
fi
 
if has sdk; then
  sdk env
fi

Warning

Run direnv allow once after cloning.

# Standard Commands with task

Instead of typing complex commands you just type task <cmd>.

version: '3'
 
tasks:
  setup:
    desc: Install dependencies and initialize environment
    cmds:
      - sdk env install
      - direnv allow
 
  clean:
    desc: Clean build artifacts
    cmds:
      - ./mvnw clean

Run commands like:

task clean

# Lefthook and EditorConfig

These prevent "pollution" of the codebase.

  • EditorConfig tells IntelliJ or VS Code syntax.
  • Lefthook acts as a final gate.

# Key Files

FilePurpose
.sdkmanrcJava & Maven versions
.envLocal variables
.env.sharedShared variables
.envrcEnvironment automation
Taskfile.ymlCommands

# Why This Works

This setup removes friction:

  • No manual setup
  • No version mismatches
  • No hidden configuration

You spend time building, not debugging your environment.

←PreviousJava Object Anatomy: What lives in Memory?Next→Java Utility Method

On this page

What We WantThe Big PictureInstall the BasicsToolsEnvironment Variables with dotenvLock Java & Maven Versions SDKMANAutomatic Environment Loading direnvStandard Commands with taskLefthook and EditorConfigKey FilesWhy This Works