Here you can find the source of executeCommandForceDir(String baseCommand, String osPath, File file)
private static void executeCommandForceDir(String baseCommand, String osPath, File file)
//package com.java2s; //License from project: Apache License import java.io.File; import java.io.IOException; public class Main { private static void executeCommandForceDir(String baseCommand, String osPath, File file) { String forceDirectoryPath = osPath; if (file.isFile()) try { forceDirectoryPath = file.getParentFile().getCanonicalPath(); } catch (IOException ex) { ex.printStackTrace();/*from ww w . j a v a 2 s . com*/ } String args[] = { baseCommand, forceDirectoryPath }; try { Runtime.getRuntime().exec(args); } catch (IOException ex) { ex.printStackTrace(); } } }