List of usage examples for java.io IOException printStackTrace
public void printStackTrace()
From source file:Test.java
public static void main(String[] a) { try {//from w ww. j av a 2 s . co m Desktop desktop = null; if (Desktop.isDesktopSupported()) { desktop = Desktop.getDesktop(); } desktop.print(new File("c:\\a.txt")); } catch (IOException ioe) { ioe.printStackTrace(); } }
From source file:Test.java
public static void main(String[] a) { try {// w w w . j a v a2 s . c o m Desktop desktop = null; if (Desktop.isDesktopSupported()) { desktop = Desktop.getDesktop(); } desktop.open(new File("c:\\a.txt")); } catch (IOException ioe) { ioe.printStackTrace(); } }
From source file:Main.java
public static void main(String[] a) throws URISyntaxException { try {//ww w . j av a 2 s.c om Desktop desktop = null; if (Desktop.isDesktopSupported()) { desktop = Desktop.getDesktop(); } desktop.mail(new URI("name@address.net")); } catch (IOException ioe) { ioe.printStackTrace(); } }
From source file:Main.java
public static void main(String[] args) { // create a new list of arguments for our process String[] list = { "notepad.exe", "test.txt" }; // create the process builder ProcessBuilder pb = new ProcessBuilder(list); try {//from ww w.jav a 2s .com // start the subprocess System.out.println("Starting the process.."); pb.start(); } catch (IOException ex) { ex.printStackTrace(); } }
From source file:Main.java
public static void main(String[] args) { // create a new list of arguments for our process String[] list = { "notepad.exe", "test.txt" }; // create the process builder ProcessBuilder pb = new ProcessBuilder(list); try {//from w w w . j a va 2 s .c o m pb = pb.redirectError(new File("c:/")); pb.start(); } catch (IOException ex) { ex.printStackTrace(); } }
From source file:Main.java
public static void main(String[] args) { // create a new list of arguments for our process String[] list = { "notepad.exe", "test.txt" }; // create the process builder ProcessBuilder pb = new ProcessBuilder(list); try {//from w w w. java 2 s.c o m pb = pb.redirectInput(new File("c:/")); pb.start(); } catch (IOException ex) { ex.printStackTrace(); } }
From source file:Main.java
public static void main(String[] args) { // create a new list of arguments for our process String[] list = { "notepad.exe", "test.txt" }; // create the process builder ProcessBuilder pb = new ProcessBuilder(list); try {/*from w w w.ja va 2s .c om*/ pb.start(); System.out.println(pb.redirectInput()); } catch (IOException ex) { ex.printStackTrace(); } }
From source file:Main.java
public static void main(String[] args) { // create a new list of arguments for our process String[] list = { "notepad.exe", "test.txt" }; // create the process builder ProcessBuilder pb = new ProcessBuilder(list); try {/*from w w w .j av a2 s. com*/ pb.start(); System.out.println(pb.redirectOutput()); } catch (IOException ex) { ex.printStackTrace(); } }
From source file:Main.java
public static void main(String[] args) { // create a new list of arguments for our process String[] list = { "notepad.exe", "test.txt" }; // create the process builder ProcessBuilder pb = new ProcessBuilder(list); try {/*from w w w. ja va 2s. com*/ pb = pb.redirectOutput(new File("c:/")); pb.start(); } catch (IOException ex) { ex.printStackTrace(); } }
From source file:Main.java
public static void main(String[] args) { List<String> texts = new ArrayList<>(); texts.add("test"); texts.add("test"); Path dest = Paths.get("twinkle.txt"); Charset cs = Charset.forName("US-ASCII"); try {/*from w w w .j a v a 2s . c o m*/ Path p = Files.write(dest, texts, cs, StandardOpenOption.WRITE, StandardOpenOption.CREATE); System.out.println("Text was written to " + p.toAbsolutePath()); } catch (IOException e) { e.printStackTrace(); } }