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
This is the problem line (as you said:)
Runnable mylookupThread = new Runnable(FilePath, SearchIndex) { ...
What's happening is that we're defining a class on-the-fly, and that class implements the Runnable
interface. When you use this syntax, the items in the parentheses are intended as constructor arguments for the superclass. Since Runnable
is an interface, not a class, it has no constructors at all, so there are definitely none that take arguments.
That said, whatever those are supposed to be, they're not used in the body of the anonymous class, so to a first approximation, you want to just drop what's inside the parentheses altogether.