This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes java.lang.ArrayIndexOutOfBoundsException: 1 >= 0 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "java.lang.ArrayIndexOutOfBoundsException: 1 >= 0" Watch "java.lang.ArrayIndexOutOfBoundsException: 1 >= 0" New topic
Author

java.lang.ArrayIndexOutOfBoundsException: 1 >= 0

John Teh
Greenhorn

Joined: Feb 23, 2010
Posts: 5
When Java console displays the following message, what does it mean ?

java.lang.ArrayIndexOutOfBoundsException: 1 >= 0

at java.util.Vector.elementAt(Unknown Source)
at cu.a(Unknown Source)
at cu.a(Unknown Source)
at eE.a(Unknown Source)
at cU.b(Unknown Source)
at bP.paint(Unknown Source)
at javax.swing.JComponent.paintToOffscreen(Unknown Source)
at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(Unknown Source)
at javax.swing.RepaintManager$PaintManager.paint(Unknown Source)
at javax.swing.BufferStrategyPaintManager.paint(Unknown Source)
at javax.swing.RepaintManager.paint(Unknown Source)
at javax.swing.JComponent._paintImmediately(Unknown Source)
at javax.swing.JComponent.paintImmediately(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.seqPaintDirtyRegions(Unknown Source)
at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60752
    
  65

Please check your private messages for an important administrative matter.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

java.lang.ArrayIndexOutOfBoundsException
Suhas Bilaye
Ranch Hand

Joined: Sep 10, 2009
Posts: 80
Hi Teh Sy,

The exception ArrayIndexOutOfBounds appears when you try to access any element from the list or array or collection which is greater than or equal to the current size(since the index starts from 0 and not from 1).

For example:

In your case too, you are accessing element no 1 out of the array/list/any other collection which does not contain any elements i.e. the size is of collection is 0

Regards,
Suhas


Thanks and Regards,
Suhas
http://www.xplore-java.blogspot.com/
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19649
    
  18

Can you show us the code for class "cu", method "a"? Because that's where the exception is coming from. It passes an invalid index to a vector's elementAt method.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
John Teh
Greenhorn

Joined: Feb 23, 2010
Posts: 5
I am new to JAVA, so I don't know what {code for class "cu", method "a" } is.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Your stack trace includes the following:So there are classes and methods being called for which we have no information. Given the names, I'd guess they're being generated. The bottom line is that somewhere there's an array that the above code is expecting to have values, and there are none.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37913
    
  22
John Teh wrote:I am new to JAVA, so I don't know what {code for class "cu", method "a" } is.
Why is somebody giving you code you don't know about, then?
John Teh
Greenhorn

Joined: Feb 23, 2010
Posts: 5
You see I am using an online software and run into problem and I look into the Java console and found these message. Thought I am new to Java, I have some background on programming in BASIC. I suspect there are some bugs in the program or some problem with the server. When I bring the matter to the vendor, there is no solution so far (already months, they still don't know what is the problem). So I am just want to learn some knowledge about Java. So far, I am satisfied with the answer provide by Suhas Bilaye and I have requested topic as resoved. Thank you for that.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37913
    
  22
What a job you have got!
You're welcome, and as you say, Suhas Bilaye gave you a correct answer. I'll click the "resolved" button.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: java.lang.ArrayIndexOutOfBoundsException: 1 >= 0
 
Similar Threads
Need help with this code
Applet in JSP
Exception doesn't tell me where it occurs
Jtable
ConcurrentModificationException