When using FilenameFilter in a Java program on a Unix machine, receive ClassNotFoundException
<p>So I have the following code:</p>

<pre><code>File txtFileDir = new File(MAIN_DIR + "test");
FilenameFilter filter = new FilenameFilter() {
    @Override
    public boolean accept(File dir, String name) {
        return name.endsWith(".txt");
    }
}; 
File[] txtFiles = txtFileDir.listFiles(filter);
</code></pre>

<p>and it works fine on my development machine which uses windows with Java 1.6 installed. However, when I port the class over to the unix box it's going to run on and try to run it I get a ClassNotFoundException on the FilenameFilter line. The unix box has Java 1.6 on it as well so I don't know what the problem could be. It's not a huge deal as there are multiple ways to accomplish this same thing, but I'm just curious if anyone has any thoughts on why it wouldn't work on the unix box.</p>

<p>I did try compiling the code on the unix box too in order to see if that made any difference but it didn't. The code compiles fine on the unix box but I still receive the same error. Anyone have any thoughts?</p>

<p><strong>UPDATE</strong></p>

<p>I figured out the issue. Apparently when I compiled the code with that class in it, it created an additional .class file with the name of my class and $1 appended onto it. So I had Test.class and Test$1.class. Once I kept the Test$1.class file things worked properly. I'm guessing it needs that second class file because of the inner class I created? At least I think that's an inner class.</p>

<p>Anyway, thanks for the help all.</p>
