List of usage examples for java.lang System err
PrintStream err
To view the source code for java.lang System err.
Click Source Link
From source file:Main.java
public static void main(String[] args) throws Exception { try {// w w w .j a v a 2 s . c o m Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); // Define the data source for the driver String sourceURL = "jdbc:odbc:technical_library"; // Create a connection through the DriverManager Connection databaseConnection = DriverManager.getConnection(sourceURL); System.out.println("Connection is: " + databaseConnection); } catch (ClassNotFoundException cnfe) { System.err.println(cnfe); } catch (SQLException sqle) { System.err.println(sqle); } }
From source file:BeanUtilsExampleV3.java
public static void main(String args[]) throws Exception { BeanUtilsExampleV3 diff = new BeanUtilsExampleV3(); Actor actor = diff.prepareData();//from w ww .j av a 2s .c o m Map describedData = BeanUtils.describe(actor); // check the map System.err.println(describedData.get("name")); // change this value describedData.put("name", "Robert Redford"); // create a new Actor Bean Actor newActor = new Actor(); BeanUtils.populate(newActor, describedData); System.err.println(BeanUtils.getProperty(newActor, "name")); }
From source file:Main.java
public static void main(String[] args) { Path myText_path = Paths.get("C:/tutorial/wiki", "wiki.txt"); Charset charset = Charset.forName("UTF-8"); ArrayList<String> lines = new ArrayList<>(); lines.add("\n"); lines.add("tutorial"); try {/*w ww .java 2 s .c om*/ Files.write(myText_path, lines, charset, StandardOpenOption.APPEND); } catch (IOException e) { System.err.println(e); } }
From source file:Main.java
public static void main(String args[]) { ScriptEngineManager manager = new ScriptEngineManager(); ScriptEngine engine = manager.getEngineByName("javascript"); try {/*from ww w .j a v a 2s . c om*/ engine.put("name", "abcde"); engine.eval("var output = '';for (i = 0; i <= name.length; i++) {" + " output = name.charAt(i)+'-' + output" + "}"); String name = (String) engine.get("output"); System.out.println(name); } catch (ScriptException e) { System.err.println(e); } }
From source file:MainClass.java
public static void main(String args[]) { URL u;//from ww w. j a v a 2 s . c o m URLConnection uc; String header; try { u = new URL("http://www.java2s.com"); uc = u.openConnection(); for (int j = 1;; j++) { header = uc.getHeaderField(j); if (header == null) break; System.out.println(uc.getHeaderFieldKey(j) + " " + header); } } catch (MalformedURLException e) { System.err.println("not a URL I understand."); } catch (IOException e) { System.err.println(e); } }
From source file:SpecialSymbolPDF.java
public static void main(String[] args) { Document document = new Document(); try {//from w w w. j a v a2s. c o m PdfWriter.getInstance(document, new FileOutputStream("SpecialSymbolPDF.pdf")); document.open(); for (int i = 913; i < 970; i++) { document.add(Phrase.getInstance(" " + i + ": " + (char) i)); } } catch (DocumentException de) { System.err.println(de.getMessage()); } catch (IOException ioe) { System.err.println(ioe.getMessage()); } document.close(); }
From source file:Skew450.java
public static void main(String[] args) { Document document = new Document(); try {/*from w w w .j a v a 2s. c o m*/ PdfWriter.getInstance(document, new FileOutputStream("Skew450.pdf")); document.open(); Chunk chunk = new Chunk("This is a chunk."); chunk.setSkew(45f, 0f); document.add(chunk); } catch (Exception e) { System.err.println(e.getMessage()); } document.close(); }
From source file:Vis.java
public static void main(String[] av) { Vis v = new Vis(); if (av.length == 0) v.process(new BufferedReader(new InputStreamReader(System.in))); else/*from ww w. j ava 2 s. c o m*/ for (int i = 0; i < av.length; i++) try { v.process(new BufferedReader(new FileReader(av[i]))); } catch (FileNotFoundException e) { System.err.println(e); } }
From source file:Skew012.java
public static void main(String[] args) { Document document = new Document(); try {//from ww w . j ava2s .c om PdfWriter.getInstance(document, new FileOutputStream("Skew012.pdf")); document.open(); Chunk italic = new Chunk("This is a chunk."); italic.setSkew(0f, 12f); document.add(italic); } catch (Exception e) { System.err.println(e.getMessage()); } document.close(); }
From source file:MainClass.java
public static void main(String args[]) throws Exception { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JTextField nameTextField = new JTextField(); frame.add(nameTextField, BorderLayout.NORTH); FileWriter writer = null;/*from www . j a v a 2 s . c o m*/ try { writer = new FileWriter("filename.txt"); nameTextField.write(writer); } catch (IOException exception) { System.err.println("Save oops"); exception.printStackTrace(); } finally { if (writer != null) { try { writer.close(); } catch (IOException exception) { System.err.println("Error closing writer"); exception.printStackTrace(); } } } frame.setSize(250, 100); frame.setVisible(true); }