All Downloads are FREE. Search and download functionalities are using the official Maven repository.

installer.src.java.org.python.util.install.JavaSelectionPageValidator Maven / Gradle / Ivy

Go to download

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.

There is a newer version: 2.7.4
Show newest version
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);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy