/** * Creates instance for Factory implementation with the provided Java home directory. Setting the "java.home" system property is thread-safe * and is set back to the original value of "java.home" after the operation. * * @param javaHomeDir Java home directory * @param factory Factory * @return Instance created by Factory implementation */ public <T> T withJavaHome(File javaHomeDir, Factory<T> factory) { return withSystemProperty("java.home", javaHomeDir.getAbsolutePath(), factory); }
/** * Creates instance for Factory implementation with the provided Java home directory. Setting the "java.home" system property is thread-safe * and is set back to the original value of "java.home" after the operation. * * @param javaHomeDir Java home directory * @param factory Factory * @return Instance created by Factory implementation */ public <T> T withJavaHome(File javaHomeDir, Factory<T> factory) { return withSystemProperty("java.home", javaHomeDir.getAbsolutePath(), factory); }