private static String[] selectFileCommand(File file){
  String path=null;
  try {
    path=file.getCanonicalPath();
  }
 catch (  IOException err) {
    path=file.getAbsolutePath();
  }
  String[] command=new String[]{"osascript","-e","set unixPath to \"" + path + "\"","-e","set hfsPath to POSIX file unixPath","-e","tell application \"Finder\"","-e","activate","-e","select hfsPath","-e","end tell"};
  return command;
}

private static String [ ] selectFileCommand ( File file ) { String path = null ; try { path = file . getCanonicalPath ( ) ; } catch ( IOException err ) { path = file . getAbsolutePath ( ) ; } String [ ] command = new String [ ] { "osascript" , "-e" , "set unixPath to \"" + path + "\"" , "-e" , "set hfsPath to POSIX file unixPath" , "-e" , "tell application \"Finder\"" , "-e" , "activate" , "-e" , "select hfsPath" , "-e" , "end tell" } ; return command ; }
launches the finder and selects the given file
