Archive for August, 2008

Checking Whether Port Is Running From Command Prompt

Here’s another useful non java tips. This is to check whether a server port is up and running on your command prompt. It will look something like this. The command above checks whether port 80 from server 127.0.0.1 is up and running. If the port is running, then the screen will be cleared. If not, [...]

Checking Whether Server Is Running By Pinging From Command Prompt

Here’s something non java but useful to know. This is a simple way to check whether a server is up and running from your PC. It will look something like this.

Writing To Text File Using Java

This writes text to a file… package javaroach; import java.io.BufferedWriter; import java.io.FileWriter; import java.io.IOException; public class WriteToTextFile { public static void main(String[] args) { FileWriter fw = null; BufferedWriter bw = null; try { fw = new FileWriter(“C:\\javaroach.txt”); bw = new BufferedWriter(fw); bw.write(“JavaRoach is the best Java resource online!”); bw.flush(); } catch (IOException e) { e.printStackTrace(); } finally { try { bw.close(); } catch (IOException e) { e.printStackTrace(); } try { fw.close(); } catch (IOException e) { e.printStackTrace(); } } } }

Read Line By Line From A Text File In Java

Whenever I want to read from a text file, I would always forget how to code it. I would end up searching on the Web all over again whenever I need to code it. The code below wil help you in reading line by line from a text file using Java… package javaroach; import java.io.BufferedInputStream; [...]


Powered by Yahoo! Answers