Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Error while run a poi program
Error while run a poi program [message #1080654] Tue, 06 August 2013 08:07
suvarna deo is currently offline suvarna deoFriend
Messages: 11
Registered: August 2013
Junior Member
hiii..
I m using centos6.4 & lastest version of juno eclipse. I want to read an excel file.
my code mention below. The problem is when i run this code as java application console appears but blank..... Is there any infinite loop? what is wrong wiyh my code? please help...



code:-

package com.ab.poi;

import java.io.FileInputStream;
import java.io.IOException;

import java.util.Iterator;

import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;

import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;



public class ExcelRead{
public static void main (String args[]){
{
try{
FileInputStream file=new FileInputStream("//home//suvarna//ATMInformation.xlsx");
XSSFWorkbook workbook=new XSSFWorkbook(file);
XSSFSheet sheet=workbook.getSheetAt(0);
Iterator<Row> rowIterator=sheet.iterator();
while(rowIterator.hasNext())
{
Row row=rowIterator.next();
Iterator<Cell> cellIterator=row.cellIterator();
while(cellIterator.hasNext());
{
Cell cell=cellIterator.next();
switch(cell.getCellType())
{
case Cell.CELL_TYPE_NUMERIC:
System.out.print(cell.getNumericCellValue() +"\t");break;
case Cell.CELL_TYPE_STRING:
System.out.print(cell.getStringCellValue() +"\t");break;
}
}
System.out.print(" ");
}
file.close();


}
catch(IOException e)
{
e.printStackTrace();
}
}
}

}
Previous Topic:Line Breaks Between Methods
Next Topic:Collect code completion proposals
Goto Forum:
  


Current Time: Thu Apr 25 05:45:51 GMT 2024

Powered by FUDForum. Page generated in 0.02926 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top