user1866571
user1866571

Reputation: 21

Exception in thread "main" java.lang.NoClassDefFoundError: =

I created a new maven project in Eclipse and on runtime I get this error:

Exception in thread "main" java.lang.NoClassDefFoundError: =
Caused by: java.lang.ClassNotFoundException: =
    at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: =. Program will exit.

In other threads the class is mentioned where the problem occurs but here it simply says nothing. The code is also used in a different project (with slight tweaks in terms of calling a method) but the rest of it is same. If anyone can help me resolve this issue..it will be highly appreciated.

Upvotes: 2

Views: 1183

Answers (2)

Rudolf Real
Rudolf Real

Reputation: 2028

Deleting the workspace worked for me.

Upvotes: 0

Jon Skeet
Jon Skeet

Reputation: 1503519

It looks like something is passing in = as the class name. It doesn't say nothing - it says =.

For example, when I run:

java =

I get:

Error: Could not find or load main class =

There's no colon, but it's otherwise the same.

Look at where you're trying to specify the class name, and see whether there's a stray = around. For example, suppose you had:

java -Dfoo = bar ClassName

instead of

java -Dfoo=bar ClassName

You'd see the same thing. I'm not familiar with Maven, but if you ever specify a set of arguments in it, I'd look at that part of the configuration file.

Upvotes: 2

Related Questions