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:ChangeLookFeelToMotifLookAndFeel.java
public static void main(String[] args) { try {// w ww. j a va 2s .c o m UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel"); } catch (Exception e) { System.err.println("Look and feel not set."); } JFrame aWindow = new JFrame("This is the Window Title"); aWindow.setBounds(50, 100, 300, 300); aWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); aWindow.setVisible(true); }
From source file:InputOutputDemoStandardInputOutput.java
public static void main(String[] a) throws Exception { //Write characters to standard output and standard error: System.out.println("std output"); System.err.println("std error"); //Read characters from standard input (the keyboard): System.out.print("Type some characters and press Enter: "); BufferedReader bisr = new BufferedReader(new InputStreamReader(System.in)); String response = bisr.readLine(); System.out.println("You typed: '" + response + "'"); //Read a byte from standard input (the keyboard): System.out.print("Type one character and press Enter: "); byte b = (byte) System.in.read(); System.out.println("First byte of your input is: " + b); }
From source file:MainClass.java
public static void main(String[] args) { if (args.length != 2) { System.err.println("Usage: java MainClass infile outfile"); }/*from w w w .j ava2 s . com*/ try { copy(args[0], args[1]); } catch (IOException ex) { System.err.println(ex); } }
From source file:StringUtilsEscapeExampleV1.java
public static void main(String args[]) { String unescapedJava = "Are you for real?"; System.err.println(StringEscapeUtils.escapeJava(unescapedJava)); String unescapedJavaScript = "What's in a name?"; System.err.println(StringEscapeUtils.escapeJavaScript(unescapedJavaScript)); String unescapedSql = "Mc'Williams"; System.err.println(StringEscapeUtils.escapeSql(unescapedSql)); String unescapedXML = "<data>"; System.err.println(StringEscapeUtils.escapeXml(unescapedXML)); String unescapedHTML = "<data>"; System.err.println(StringEscapeUtils.escapeHtml(unescapedHTML)); }
From source file:ShowProperties.java
public static void main(String[] args) throws FileSystemException { if (args.length == 0) { System.err.println("Please pass the name of a file as parameter."); System.err.println("e.g. java org.apache.commons.vfs2.example.ShowProperties LICENSE.txt"); return;/* w w w . j a v a2 s .c om*/ } for (int i = 0; i < args.length; i++) { try { FileSystemManager mgr = VFS.getManager(); System.out.println(); System.out.println("Parsing: " + args[i]); FileObject file = mgr.resolveFile(args[i]); System.out.println("URL: " + file.getURL()); System.out.println("getName(): " + file.getName()); System.out.println("BaseName: " + file.getName().getBaseName()); System.out.println("Extension: " + file.getName().getExtension()); System.out.println("Path: " + file.getName().getPath()); System.out.println("Scheme: " + file.getName().getScheme()); System.out.println("URI: " + file.getName().getURI()); System.out.println("Root URI: " + file.getName().getRootURI()); System.out.println("Parent: " + file.getName().getParent()); System.out.println("Type: " + file.getType()); System.out.println("Exists: " + file.exists()); System.out.println("Readable: " + file.isReadable()); System.out.println("Writeable: " + file.isWriteable()); System.out.println("Root path: " + file.getFileSystem().getRoot().getName().getPath()); if (file.exists()) { if (file.getType().equals(FileType.FILE)) { System.out.println("Size: " + file.getContent().getSize() + " bytes"); } else if (file.getType().equals(FileType.FOLDER) && file.isReadable()) { FileObject[] children = file.getChildren(); System.out.println("Directory with " + children.length + " files"); for (int iterChildren = 0; iterChildren < children.length; iterChildren++) { System.out.println("#" + iterChildren + ": " + children[iterChildren].getName()); if (iterChildren > 5) { break; } } } System.out.println("Last modified: " + DateFormat.getInstance().format(new Date(file.getContent().getLastModifiedTime()))); } else { System.out.println("The file does not exist"); } file.close(); } catch (FileSystemException ex) { ex.printStackTrace(); } } }
From source file:MainClass.java
public static void main(String[] args) throws IOException { if (args.length < 2) { System.err.println("Usage: java MainClass inFile1 inFile2... outFile"); return;//w w w. ja va2s. c o m } ByteBuffer[] buffers = new ByteBuffer[args.length - 1]; for (int i = 0; i < args.length - 1; i++) { RandomAccessFile raf = new RandomAccessFile(args[i], "r"); FileChannel channel = raf.getChannel(); buffers[i] = channel.map(FileChannel.MapMode.READ_ONLY, 0, raf.length()); } FileOutputStream outFile = new FileOutputStream(args[args.length - 1]); FileChannel out = outFile.getChannel(); out.write(buffers); out.close(); }
From source file:MainClass.java
public static void main(String[] args) { try {//from ww w . j ava 2 s . com URL u = new URL("http://www.java2s.com"); Object o = u.getContent(); System.out.println("I got a " + o.getClass().getName()); } catch (Exception ex) { System.err.println(ex); } }
From source file:Main.java
public static void main(String[] a) { FileInputStream inputFile = null; try {/*from w ww . ja va 2 s . com*/ inputFile = new FileInputStream("C:/myFile.txt"); } catch (FileNotFoundException e) { e.printStackTrace(System.err); } }
From source file:LanguageUsage.java
public static void main(String args[]) { LanguageUsage codec = new LanguageUsage(); try {/*ww w .j a v a 2 s.com*/ codec.start(); } catch (Exception e) { System.err.println(e); } }
From source file:ArrayUtilsExampleV1.java
public static void main(String args[]) { long[] longArray = new long[] { 10000, 30, 99 }; String[] stringArray = new String[] { "abc", "def", "fgh" }; long[] clonedArray = ArrayUtils.clone(longArray); System.err.println(ArrayUtils.toString((ArrayUtils.toObject(clonedArray)))); System.err.println(ArrayUtils.indexOf(stringArray, "def")); ArrayUtils.reverse(stringArray);// w w w . ja v a2 s . c om System.err.println(ArrayUtils.toString(stringArray)); }