public void validate(EnvironmentVariableContext environmentVariableContext) throws ValidationException {
VariableValue varValue = environmentVariableContext.getVariableValue();
String varName = environmentVariableContext.getVariableName();
String output;
ProcessLauncher processLauncher = new JavaLauncher(varValue.getAsFile());
Map<String, String> environmentVariables = environmentVariableContext.getEnvironment().getVars(RenderHint.native_os);
processLauncher.addEnvironmentVariables(environmentVariables);
processLauncher.addCommand("-version");
Process process = processLauncher.exec();
output = ProcessUtils.readOutput(process);
if (output == null) {
throw new ValidationException("can not validate " + varName + ", java process returned no output!");
}