List of utility methods to do File Attribute
File | javaExecutable(File jre) java Executable if (!jre.isDirectory()) { return null; File bin = new File(jre, "bin"); if (bin != null && bin.isDirectory()) { String os = System.getProperty("os.name").toLowerCase(); String exeName = os.contains("win") ? "java.exe" : "java"; return new File(bin, exeName); ... |
Process | launchExecutable(String executable, List launch Executable List<String> command = new ArrayList<>(); try { if (preferences.get("commandMono", "mono").isEmpty()) { command.add( new File(preferences.get("basedir", null), "working").getAbsolutePath() + "/" + executable); } else { command.add(preferences.get("commandMono", "mono")); command.add(executable); ... |
String | makeCurrentDirectoryThatOfExecutable(String executable) Set the directory to that of the executable, such that "c:\some\dir\file.exe" will set to "c:\some\dir\" String curDir, newDir; curDir = getCurrentDirectory(); newDir = new File(executable).getParent(); setCurrentDirectory(newDir); return (curDir); |
void | makeExecutable(File file) Give execute privilege to a UNIX file Written by: S. String[] cmds2 = { "chmod", "-R", "+rx", file.getAbsolutePath() }; Process child1 = Runtime.getRuntime().exec(cmds2); child1.waitFor(); |
boolean | makeExecutable(File file) Attempt to make the given file executable. if (file.setExecutable(true, false)) { return true; return file.setExecutable(true, true); |
void | makeExecutable(File file) Attempt to make a file executable. Process p = Runtime.getRuntime().exec(new String[] { "chmod", "ug+rx", file.getAbsolutePath() }); try { copy(p.getErrorStream(), new ByteArrayOutputStream()); } finally { try { if (p.waitFor() != 0) { throw new IOException("Failed to set execute permission. Return code " + p.exitValue() + "."); } catch (InterruptedException e) { |
void | makeExecutable(File file) Mark a file as executable. if (File.separatorChar == '/') try { if (Runtime.getRuntime().exec(new String[] { "chmod", "+x", file.getPath() }).waitFor() != 0) throw new IOException("chmod +x " + file + " failed"); } catch (InterruptedException e) { throw new IOException("Interrupted waiting for chmod +x " + file); |
void | makeExecutable(File target) Gives the target or it's contents executable permissions. if (target.isFile()) { target.setExecutable(true); } else { for (File file : target.listFiles()) { makeExecutable(file); |
void | makeExecutable(String path) make Executable if (path == null) { return; File file = new File(path); if (file.exists() && !file.canExecute()) { file.setExecutable(true); |
void | parallel(ExecutorService executor, Collection extends Callable>> tasks) parallel List<Future<?>> futures = tasks.stream().map(task -> executor.submit(task)).collect(Collectors.toList()); for (Future<?> future : futures) { try { future.get(); } catch (CancellationException | InterruptedException e) { cancel(futures); throw e; } catch (ExecutionException e) { ... |