Fixing issue : The environment variable JAVA_HOME is not correctly set

Vishwa Mohan
1 min readMay 16, 2018

--

One common error while building any maven project through IDE( like eclipse or intelliJ) is “Error while creating archive: Unable to find javadoc command: The environment variable JAVA_HOME is not correctly set”

Type of fixes :

1 (Best I liked, works for all)

Update the base pom.xml like below :

<plugin>
...
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<javadocExecutable>${java.home}/../bin/javadoc</javadocExecutable>
</configuration>
...
</plugin>

2. For eclipse

You can add the JAVA_HOME as an environment variable in eclipse.

Go to your maven build-> add the following.

Click New->

Name: JAVA_HOME

Value : “your jdk path here” . Ex : /Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home

--

--

Vishwa Mohan

Software Developer | Technology Enthusiast | Love my mom| Learning from life every day