I’m not a java guy but I’ve inherited some code I need to patch up. I pulled the source into netbeans and I’m getting the error: Anonymous class implements interface; cannot have arguments.
Here’s the code:
Executor background = Executors.newSingleThreadExecutor();
Runnable mylookupThread = new Runnable(FilePath, SearchIndex)
{
public void run()
{ MainWindow.this.processFile(this.val$FilePath);
Thread t = new Thread(new lookupThread(MainWindow.arrFile, true, false, this.val$SearchIndex));
t.setName("Lookup");
t.setPriority(10);
t.start();
}
};
background.execute(mylookupThread);
Executor statusThread = Executors.newSingleThreadExecutor();
Runnable myStatusThread = new Runnable()
{
public void run()
{ MainWindow.this.updateStatus();
}
};
statusThread.execute(myStatusThread);
The error pops up on the second line. Help?!?
Make
mylookupThreadseparate class, make it’s instance and pass it toExecutor:Other way around is to make
filePath, searchIndexfinal: