user1366697
user1366697

Reputation: 171

Compiler is creating extra class files with $ in them

I'm using Eclipse and I've written a Java application using SWT. When Eclipse compiles my program, it renames my main file into 4 different files like this:

When I go to run this program from command line, I get

Could not find the main class: MainFile.class. Program will exit.

I really don't understand why this is happening.

Upvotes: 1

Views: 1160

Answers (1)

Louis Wasserman
Louis Wasserman

Reputation: 198103

The $ classes are for anonymous inner classes and perfectly normal.

Could we see the command line you ran? You probably need to write java MainFile instead of java MainFile.class.

Upvotes: 5

Related Questions