List of usage examples for java.awt Desktop edit
public void edit(File file) throws IOException
From source file:Main.java
public static void main(String[] a) { try {/* w w w. j av a2 s .c om*/ Desktop desktop = null; if (Desktop.isDesktopSupported()) { desktop = Desktop.getDesktop(); } desktop.edit(new File("c:\\a.txt")); } catch (IOException ioe) { ioe.printStackTrace(); } }
From source file:de.evaluationtool.gui.EvaluationFrameActionListener.java
private void editNameSourceFile() throws IOException, InterruptedException { try {/* w w w.jav a 2 s . c o m*/ Desktop desktop = Desktop.getDesktop(); desktop.edit(new File("config/namesources.tsv")); } catch (Exception e) { //Fallback final Process p = Runtime.getRuntime().exec("gedit config/namesources.tsv"); if (p.waitFor() != 0) { final Process q = Runtime.getRuntime().exec("edit config/namesources.tsv"); } // (new Thread() { // @Override // public void run() // { // try { // // normal termination // int returnCode = p.waitFor(); // System.out.println(returnCode); // if(returnCode==0) // { // System.out.println("terminated!!"); // frame.reloadNamesources(); // frame.startLabelThread(); // } // } catch (InterruptedException e) {} // } // }).start(); } }
From source file:npm.modules.java
public boolean openafile(String path) throws Exception { File file = new File(path); Desktop desktop = Desktop.getDesktop(); desktop.edit(file); return true;//from ww w . ja v a 2s. co m }