Thursday, 23 May 2013

How to read a file in Java ?


package com.file.read;

import java.io.FileReader;
import java.io.BufferedReader;
import java.io.IOException;

public class ReadFileInJava {

public static void main(String[] args) {

BufferedReader buffRead = null;

try {

String eachLine;

buffRead = new BufferedReader(new FileReader("C:\\readfile.txt"));

while ((eachLine = buffRead.readLine()) != null) {
System.out.println(eachLine);
}

} catch (Exception e) {
e.printStackTrace();
} finally {
try {
/*
* close the BufferReader if there is any exception.
*/
if (buffRead != null)buffRead.close();
} catch (IOException ex) {
ex.printStackTrace();
}
}

}
}

How to Create First Application for Eclipse RCP ?



How to Create First Application for Eclipse RCP ?
Go to File -> new -> Project …


Select “Plug-in Development” -> “Plug-in Project”

 Write down project name.
E.g. “MyFirstApp”.



 Select “Would you like to create rich client application?” to “yes”.
Press Next.







Select RCP mail template (we are taking somewhat complex application)



Click on “Finish”.



Here you see the basic in build example of Eclipse RCP.
Right click on “MyFirstApp” in “Package Explorer” and then click on “Run As” -> “Eclipse Application”.



You see the Application of mail box.




How to add custom features in your application that can be seen in next post…