I discovered that I was also having this error in NetBeans. I hope the following is helpful.
This was the problem I was getting because I had other "test" programs I was using in NetBeans and I had to make sure the Main Class under the Run portion of the Project configuration was set correctly.
many blessings, John P