• Post Reply Bookmark Topic Watch Topic
  • New Topic

java.lang.ArrayIndexOutOfBoundsException: 0 >= 0  RSS feed

 
ganapathi sundaram
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am facing an exception below when i try to write data into Swing JTable cell component.

Could you please anyone help me to resolve it..?

/*
java.lang.ArrayIndexOutOfBoundsException: 0 >= 0
at java.util.Vector.elementAt(Vector.java:427)
at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:648)
at anicham.xl.assit.summary.JFrmXLSummary.displayExcelDataToGrid(JFrmXLSummary.java:726)
at anicham.xl.assit.summary.JFrmXLSummary.readExcelFile(JFrmXLSummary.java:713)
at anicham.xl.assit.summary.JFrmXLSummary.btnImportActionPerformed(JFrmXLSummary.java:641)
at anicham.xl.assit.summary.JFrmXLSummary.access$400(JFrmXLSummary.java:28)
at anicham.xl.assit.summary.JFrmXLSummary$5.actionPerformed(JFrmXLSummary.java:552)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
*/

I have given sample code here..



Thanks in advance...!

Regards,
Ganapathisundaram
 
Campbell Ritchie
Marshal
Posts: 56533
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you trying to get the no 0 element from a 0‑length array? That will produce such an exception.
 
Lalit Mehra
Ranch Hand
Posts: 384
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
make sure that the array is populated before reading from its indexes.
 
Ramesh Pramuditha Rathnayake
Ranch Hand
Posts: 178
2
Java MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't understand why you wrote int row=1 in the outer for-loop. Are you trying to omit the first row..?

And I think that excelData has only one row..!(But I'm not sure of it) If that's false, check whether the array is initialized correctly.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!