This is where you talk about the NXJ software itself, installation issues, and programming talk.
Moderators: imaqine, 99jonathan, roger
Simply remove the "throws Exception" and see whether the code still compiles. The compiler will tell you which line is problematic and which Exception is thrown in that line.
I'm pretty sure, it's just something technical - maybe an InterruptedException or so. Making the main method throw exceptions could be argued to be bad style. However, given the fact that these are just simple sample snippets and you probably want the Exception stack trace on the screen anyway, it's acceptable to make the main method throw Exceptions. The JVM will take care of printing the exception thrown by the main method to the screen.
- leJOS Team Member
- Posts: 1275
- Joined: Thu Oct 30, 2008 4:54 pm
Thank you, that's pretty clear to me. It does compile and run when I remove throws Exception from main, even with a servo being cotrolled by an UltrasonicSensor distance reading. I can see the JVM handling Exceptions and printing them to the screen if, say, I turn off the servo power or put a range that is out of bounds for the servo but I haven't been able to cause any Exceptions for the sensor. I'll keep playing with it.
- New User
- Posts: 12
- Joined: Mon Jun 10, 2013 7:33 pm
Return to NXJ Software
Who is online
Users browsing this forum: cwpark and 6 guests