--- jdk9/jdk/src/java.base/share/classes/jdk/internal/loader/ClassLoaders.java 2017-10-24 09:33:07.188671701 +0200 +++ jdk9/jdk/src/java.base/share/classes/jdk/internal/loader/ClassLoaders.java 2017-10-24 14:53:52.881676873 +0200 @@ -26,6 +26,7 @@ package jdk.internal.loader; import java.io.File; +import java.io.FileInputStream; import java.io.IOException; import java.net.URL; import java.nio.file.InvalidPathException; @@ -33,6 +34,7 @@ import java.security.CodeSource; import java.security.PermissionCollection; import java.util.jar.Manifest; +import java.util.Properties; import jdk.internal.misc.JavaLangAccess; import jdk.internal.misc.SharedSecrets; @@ -79,6 +81,59 @@ if (mainMid == null || cp.length() > 0) addClassPathToUCP(cp, ucp); + // Get accessibility properties + final String sep = File.separator; + final Properties properties = new Properties(); + + // Try loading the per-user accessibility properties file. + try { + File propsFile = new File( + System.getProperty("user.home") + + sep + ".accessibility.properties"); + FileInputStream in = + new FileInputStream(propsFile); + + // Inputstream has been buffered in Properties class + properties.load(in); + in.close(); + } catch (Exception e) { + // Per-user accessibility properties file does not exist + } + + // Try loading the system-wide accessibility properties + // file only if a per-user accessibility properties + // file does not exist or is empty. + if (properties.size() == 0) { + try { + File propsFile = new File( + System.getProperty("java.home") + sep + "conf" + + sep + "accessibility.properties"); + FileInputStream in = + new FileInputStream(propsFile); + + // Inputstream has been buffered in Properties class + properties.load(in); + in.close(); + } catch (Exception e) { + // System-wide accessibility properties file does + // not exist; + } + } + + // Add the jar with assistive technologies to the looked up classpath. + final String atCp = properties.getProperty("assistive_technologies.classpath", null); + if (atCp != null) { + File atCpFile = new File(atCp); + if (atCpFile.exists()) { + addClassPathToUCP(atCp, ucp); + if (cp == null || cp.isEmpty()) { + System.setProperty("java.class.path", atCp); + } else { + System.setProperty("java.class.path", cp + System.getProperty("path.separator") + atCp); + } + } + } + // create the class loaders BOOT_LOADER = new BootClassLoader(bcp); PLATFORM_LOADER = new PlatformClassLoader(BOOT_LOADER);