Setting up for java dev on Windows with Chocolatey

This guide shows steps for the complete setup of Windows pc for developing java applications.

Traditionally, software packages on Windows are installed by manually downloading them from their web pages. This feels very fiddly when compared to using Unix package managers such as yum. Fortunately, there is Chocolatey, which brings some of this experience to Windows.

So, chocolatey is yum, although it isn’t…

Install Choclolatey

Run this command as admin

@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command " [System.Net.ServicePointManager]::SecurityProtocol = 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"

If you already had it installed you might want to update it and then update already installed packages and see what’s actually installed

choco upgrade chocolatey
choco list --local-only
choco outdated
choco upgrade all

Install Java Open JDK

choco install openjdk

Add the OpenJDK bin directory to the path. There is a way to do it from the command line but sometimes it’s best to inspect what’s already on the path. It is more readable in the settings window, so type ‘environment’ in windows start to find the shortcut that will get you to it. Click ‘Environment Variables…’ button and edit the Path variable. Add a line that will look similar to this:

C:\Program Files\OpenJDK\jdk-14.0.1\bin

Next, you can optionally add java API sources and documentation. If you open a new terminal after installing java, you can use ‘jar’ command for unpacking archives.

mkdir %userprofile%/javasrc
cd %userprofile%/javasrc
jar xvf "%JAVA_HOME%/lib/src.zip"

For documentation you need to manually download it from:https://www.oracle.com/java/technologies/javase-downloads.html

Unpack, open index.html in your browser and add a bookmark.

Install notepad++

I use it as an editor for git config and for all other random text editing tasks.

choco install notepadplusplus

Install git client

choco install git.install --params "/GitOnlyOnPath /SChannel /NoGitLfs /NoShellIntegration"

This installs git with following options:

  • Puts git on PATH but not the additional tools
  • Uses windows native ssl/tls implementation and not OpenSSL
  • No git large file storage installation (not needed for most development)
  • No windows explorer integration
  • core.autocrlf set to true
  • Use Git Credential Manager

I’m not good at vim, so I set default editor to notepad++.

git config --global core.editor "notepad++  -multiInst -notabbar -nosession -noPlugin"

Install sourcetree – git GUI

For git operations I usually either use command line or IDE integrated tools. However, now and again there comes a time when your team will make a Gordian knot of your git branches. Sometimes it is just useful to inspect visually WTF is going on.

choco install sourcetree

Install JetBrains IntelliJ Idea

For free community edition run

choco install intellijidea-community

And for ultimate

choco install intellijidea-ultimate

Install Maven

choco install maven

You’re done

Hurray!

Leave a Reply

Your email address will not be published. Required fields are marked *