[Technical] Setting up a Java development environment on Windows

 

Becoming a java developer, again

Once again we are at that time of the year when I want to do code. And as my time is limited, I will focus on Java, and as usual, most tools have changed and being able to code from the command line, and an IDE requires doing complicated things

My goal is to set up a Java 10 8, Git, Gradel available from the command line.

Where to put the files

The first step is to create a folder C:\dev for all software and repositories

Installing and config of Java 10 8

Installing version 10 ended being a nightmare as Eclipse and Gradle are not fully compatible yet. I wasted 4 hours fighting against it and decided that it was not worth it. Using Java 8 solved it all. I did not install Java 9 because Gradle seems to have issues with it.

The JDK download link from the official site and installed only the JDK (no source or JRE) into c:\dev\jdk-8

Then I created the environment variable (help from https://stackoverflow.com/questions/1672281/environment-variables-for-java-installation)

  • JAVA_HOME : C:\dev\jdk-8
  • JDK_HOME : %JAVA_HOME%
  • JRE_HOME : %JAVA_HOME%\jre
  • CLASSPATH : .;%JAVA_HOME%\lib
  • PATH : your-unique-entries;%JAVA_HOME%\bin

Testing by running in a command line (cmd) java and javac. All good

Installing and config of Git

https://git-scm.com/download/win

Using portable Git and installing it in C:\dev\PortableGit

Adding C:\dev\PortableGit to the path and testing by opening a new cmd (otherwise the environment variables are not reloaded)

git exist

Creating git repository

I then created a folder called c:\dev\git where I’ll put my and other repositories

c:\dev\git>git clone -v –progress https://github.com/robevansuk/gdax-java.git

(I plan to play creating a small trading bot for Gdax a cryptocurrency exchange)

All good the repository is on my computer

Installing and config of Gradle

Creating c:\dev\Gradle

Download binaries only from https://gradle.org/next-steps/?version=4.6&format=bin

Unpack the content of the file in c:\dev\Gradle

Adding GRADLE_HOME as c:\dev\Gradle

Create the folder c:\dev\Gradle\home to be the user home. It is in the home folder that Gradle downloads additional software etc.

Adding GRADLE_USER_HOME as c:\dev\Gradle\home

Adding %GRADLE_HOME%\bin to the path

Testing by running Gradle -v in a new command line (cmd)

All good I’ve 4.6 installed

Final – some references

The Gradle wrapper is something new. I used this page to understand more and this blog post.

Leave a Reply

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