Welcome to the CSC Q&A, where you can get help (and share your knowledge) about computer science!

Errors in Eclipse

+7 votes
In Eclipse, when you run your program and get stopped by red errors in the console, can you make sense of what the red words are telling you and use that to help fix your problem? Is there any other good way to figure out the bugs within your code, when it supposedly does't show any bugs (no red x's) until you run it?
asked Oct 6, 2016 in CSC 211 (F16) by Livy Zienty (100 points)

3 Answers

+2 votes
You can google search the error name on google to see what your code did wrong. One of those errors could occur in your program is IndexOutOfBoundsException: when you are trying to access a non-existing index of a string (for example when you try to call text.charAt(3)  with a string text = "abc" that has the last index of 2)
answered Oct 6, 2016 by Minh Ta (1,045 points)
Thank you, I will google the errors and go from there!
0 votes
I don't know if you are talking about practic-it, but practice-it will never underline the errors until you run it, no matter what the bug is.
answered Oct 6, 2016 by Jack Cannell (437 points)
0 votes

The red error message will tell you the type of error up near the top, and sometimes a little message that can be helpful.

However, perhaps more important, the red error message will tell you what LINE of your program the error occurred on.  (This isn't necessarily the line that had the bug-- the bug could have been setting an inappropriate value earlier, which caused the error to happen later when that value got used...)  However, it's generally helpful to know what line number the error occurred on.    

The red text lists multiple line numbers, because it shows what method CALLED what other method, which caused the error.  These line numbers / files are listed in reverse order of which method called which.  Sometimes the error happened inside one of the standard Java library methods... so find the FIRST line that mentions YOUR .JAVA PROGRAM FILE, and look at what line number that mentions.

answered Oct 10, 2016 by Forrest Stonedahl (3,308 points)