I'm working on a basic applet and I'm getting the following error when I compile in Eclipse:
java.lang.NullPointerException
at java.applet.Applet.getParameter(Applet.java:191)
at com.putable.clickaid.ClickAid.<init>(ClickAid.java:18)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at java.lang.Class.newInstance(Class.java:379)
at sun.applet.AppletPanel.createApplet(AppletPanel.java:795)
at sun.applet.AppletPanel.runLoader(AppletPanel.java:724)
at sun.applet.AppletPanel.run(AppletPanel.java:380)
at java.lang.Thread.run(Thread.java:745)
When I try to run it with appletviewer, I get a blank window and a notification that the applet hasn't been initialized. (I get the empty window on Eclipse, too.) If I try to compile the files via the command line, I get repeated "cannot find symbol" errors for the other classes in the package. (I'm not getting anything like this in Eclipse.) Here's the first part of the main class, along with part of the constructor (I'll post more code if needed):
public class ClickAid extends Applet implements ActionListener {
int rows;
int columns;
ActiveSquare[][] buttons = new ActiveSquare[rows][columns];
int appxMax = 0;
int appyMax = 0;
private static final long serialVersionUID = 1L;
public ClickAid() {
if (getParameter("ROWS") == null) {rows = 4;}
rows = Integer.parseInt(getParameter("ROWS"));
columns = 6;
if (getParameter("COLUMNS") == null) {columns = 6;}
else {columns = Integer.parseInt(getParameter("COLUMNS"));}
...
I know that seems like a lot of questions in one, but I'm assuming at least some of them are related. My main concern is the issue with fetching the parameters - I set them up via run configurations, and I haven't been able to find any clues as to why it's not working.