Maven + JAVA_HOME

PAUL DAVIES
1 min readMay 28, 2019

--

Many times you have come across a scenario wanting you too tell maven where JAVA_HOME is located. As a result, you required to set up the JAVA_HOME path so that maven is able to get it.

It took me hours of researching why even after including jdk in the system path I could not be able to compile and run my Spring Boot application. Until I came around some hacks that helped. I there am sharing the same here.

Maven uses JDK and not JRE. You therefore need to configure the build path such that it reads JDK.

The first setup is navigating to the environment variables and setup a new variable in the system paths called JAVA_HOME. This is what maven will be looking for. In the name of the variable indicate JAVA_HOME. In the path, put the path to JDK. I insist, JDK.

Where issues begin is how you put the path.

It should not contain “bin” folder.

It should not contain the “\” symbol at the end.

If you adhere to those two, be sure 90% of your issues are solved. Because majority of use forget and do the other way round. Leading to hours of troubleshooting without success.

Open the location of you project, open the project folder and run the following command: “mvn spring-boot:run” .

The project should successfully compile and build. Look, that is how simple it is. Cheers!

--

--

PAUL DAVIES
PAUL DAVIES

Written by PAUL DAVIES

Software Developer; Java, Angular2+,RxJS,Spring boot,Android

No responses yet