private void ensureDownloaded(File file, String downloadLink) throws IOException { if (file.exists()) { file.delete(); } file.getParentFile().mkdirs(); System.out.println("Copying: " + downloadLink + " -> " + file); FileTools.streamFileTo(downloadLink, file); }
public Neo4jRunner() throws IOException { if (canControlServer() && !neo4jHome.exists()) { // download neo4j server from a URL File neo4jTarball = new File("./target/" + neo4jVersion + ".tar.gz"); ensureDownloaded(neo4jTarball, neo4jLink); // Untar the neo4j server System.out.println("Extracting: " + neo4jTarball + " -> " + neo4jDir); FileTools.extractTarball(neo4jTarball, neo4jDir, neo4jHome); } }