Hi michael, Welcome to CodeRanch First things firsts- Please UseCodeTags to post your source code- You can do it by editing your post.That way the code is more readable. Also please TellTheDetails post the stacktrace for the exception. See that you are not using any of the uninitialized references in the event handler.
. . . and some of the logic. It took about 21 seconds ( ) to work out prime numbers under 150, including 143. I didn't know 143 is a prime number. I always thought it was 11 × 13.
I would expect calculating prime numbers up to 150 to take maybe 1 millisecond.
Matthew Brown wrote: . . . is that a ridiculous name for a method that does that?
Close examination of the documentation for that method does not reveal a "since" clause. That suggests this method was introduced in the very earliest stages of development of Java™. There were quite a lot of mistakes made in the earlier stages (Joshau Bloch in Effective Java quotes "public class Stack extends Vector" as another example), and the name of that method was obviously one of them. The only way to correct it at this stage would be to add a @Depracted tag to that method and "@deprecated Use Integer#getIntegerFromPropertyName instead" to its documentation comments.
Well done finding the problem. What was happening before was
You were passing the text, maybe "1234"
The System class looks for a system property called "1234"
It can't find anything by that name.
The getInteger method returns null
The JVM attempts to un-box that null, but that is not possible.
The Exception is thrown.
As we said, a fascinating error.
Have you got the finding of prime numbers worked out yet? It should take maybe 1 or 2 milliseconds to iterate through several thousand numbers with a Sieve of Eratosthenes. Something is going very wrong if it takes 21 seconds.