Click to See Complete Forum and Search --> : jave program to read a file


r.iqbal
04-08-2005, 05:29 AM
Hi all,
Earlier I posted this message to get help from java-script developer but Khalid told me that this problem could be solved using java program. So, I am posting this message here to get help from all of you.

I have an application (monitoring software) running on windows XP. It captures information from several machine and shows results in four columns: computer – user – running application – URL (I do not know how the developer has developed these columns in the application using which software) This software is available here: (http://www.systracker.com/Network_Monitor.asp). I want to write a program that can read a file generated by this software and I want to display results in a graph showing that how many application in total running. For example, I want to see how many users are currency running ms.word. (eg., 30%).
Please let me know if anybody has any idea how to deal with this or can give me a sample program. I will be highly thankful to you.

Cheers,
Rahat

Khalid Ali
04-08-2005, 10:21 AM
Here is a simple method that will read a file.
Make sure that path to file is a valid one.


/**
* Simple method that will read a file.
* @param filePath
*/
public void readFile(String filePath){
if(null!=filePath && !filePath.equals("")){
filePath = fileName;
}

try{
BufferedReader br = new BufferedReader(new FileReader(filePath));
String line = "";
while((line = br.readLine())!=null){
System.out.println("LINE: "+line);
}
}catch(java.io.IOException ioe){
ioe.printStackTrace();
}
}

r.iqbal
04-08-2005, 04:00 PM
Thank you, Khalid for your help.

r.iqbal
04-08-2005, 04:00 PM
Thank you, Khalid, for your help.