Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
Hey, im currently making a 3D modeling program in java (its for a game). And, everything was working fine until yesterday. Eclipse shows no errors, and this shouldn't be happening, but I get the
Code :
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
I know what it means, but I cant seem to fix it. My code is too long to post here (1000+ lines), but heres the section that is causing the error -
Code :
public static void main(String[] args)
{
new MCModeler(Integer.parseInt(args[0]));
}
}
If you want to see the full code, just ask.
Thanks
Re: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
It appears to me that your code is written to use the command line parameters, and you're calling it without passing in any command line parameters. As I see it you have two possible choices, maybe more:
- you could only call this program with command line parameters, or
- have the code check first to see if any command line parameters have been passed. If none have been passed then either exit or else do some default behavior.
Re: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
Ill try that, thanks
--- Update ---
Didn't seem to work, any other ideas?
Re: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
Quote:
Originally Posted by
maxattack
Ill try that, thanks
--- Update ---
Didn't seem to work, any other ideas?
"didn't seem to work" tells us squat. You need to tell us and show us more. What did you try? What code changes have you made? What specific errors is this code causing?