installer.src.java.org.python.util.install.JavaSelectionPageValidator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jython Show documentation
Show all versions of jython Show documentation
Jython is an implementation of the high-level, dynamic, object-oriented
language Python written in 100% Pure Java, and seamlessly integrated with
the Java platform. It thus allows you to run Python on any Java platform.
package org.python.util.install;
import org.python.util.install.Installation.JavaVersionInfo;
public class JavaSelectionPageValidator extends AbstractWizardValidator {
JavaSelectionPage _page;
JavaSelectionPageValidator(JavaSelectionPage page) {
super();
_page = page;
}
protected void validate() throws ValidationException {
JavaVersionInfo javaVersionInfo = new JavaVersionInfo();
String directory = _page.getJavaHome().getText().trim(); // trim to be sure
JavaHomeHandler javaHomeHandler = new JavaHomeHandler(directory);
if(javaHomeHandler.isDeviation()) {
javaVersionInfo = Installation.getExternalJavaVersion(javaHomeHandler);
if (javaVersionInfo.getErrorCode() != Installation.NORMAL_RETURN) {
throw new ValidationException(javaVersionInfo.getReason());
}
} else {
// no experiments if current java is selected
Installation.fillJavaVersionInfo(javaVersionInfo, System.getProperties());
}
FrameInstaller.setJavaHomeHandler(javaHomeHandler);
FrameInstaller.setJavaVersionInfo(javaVersionInfo);
}
}