in src/main/java/org/apache/sling/feature/maven/mojos/apis/JavadocExecutor.java [120:160]
private static File getJavadocExecutable() throws MojoExecutionException {
String javadocCommand = "javadoc" + (SystemUtils.IS_OS_WINDOWS ? ".exe" : "");
File javadocExe;
// For IBM's JDK 1.2
if (SystemUtils.IS_OS_AIX) {
javadocExe = getFile(SystemUtils.getJavaHome(), "..", "sh", javadocCommand);
}
// For Apple's JDK 1.6.x (and older?) on Mac OSX
else if (SystemUtils.IS_OS_MAC_OSX && org.apache.commons.lang.SystemUtils.JAVA_VERSION_FLOAT < 1.7f) {
javadocExe = getFile(SystemUtils.getJavaHome(), "bin", javadocCommand);
} else {
javadocExe = getFile(SystemUtils.getJavaHome(), "..", "bin", javadocCommand);
}
// ----------------------------------------------------------------------
// Try to find javadocExe from JAVA_HOME environment variable
// ----------------------------------------------------------------------
if (!javadocExe.exists() || !javadocExe.isFile()) {
String javaHome = System.getenv().get("JAVA_HOME");
if (StringUtils.isEmpty(javaHome)) {
throw new MojoExecutionException("The environment variable JAVA_HOME is not correctly set.");
}
File javaHomeDir = new File(javaHome);
if ((!javaHomeDir.exists()) || javaHomeDir.isFile()) {
throw new MojoExecutionException("The environment variable JAVA_HOME=" + javaHome
+ " doesn't exist or is not a valid directory.");
}
javadocExe = getFile(javaHomeDir, "bin", javadocCommand);
}
if (!javadocExe.exists() || !javadocExe.isFile()) {
throw new MojoExecutionException("The javadoc executable '" + javadocExe
+ "' doesn't exist or is not a file. Verify the JAVA_HOME environment variable.");
}
return javadocExe;
}