Missing .class file for an interface and junit crashes withNoClassDefFound

M

Mark Spezzano

Hi,

Why does my IDE not generate a .class file for an interface I need to
run junit?

I've looked in the classes folder and lo and behold there is no
corresponding .class file generated for a .java interface file.

I am using Eclipse 3.4 and JDK 1.6_14.

When I run Junit from within the Eclipse IDE everything runs fine.

From the command line, the ant build script complains aobut
NoClassDefFound error, so presumably it's trying to load the .class
file for the interface and can't find it.

How can I get the compiler to generate the .class file?

Cheers,

Mark
 
J

John B. Matthews

Mark Spezzano said:
Why does my IDE not generate a .class file for an interface I need to
run junit?

I've looked in the classes folder and lo and behold there is no
corresponding .class file generated for a .java interface file.

I am using Eclipse 3.4 and JDK 1.6_14.

When I run Junit from within the Eclipse IDE everything runs fine.

From the command line, the ant build script complains aobut
NoClassDefFound error, so presumably it's trying to load the .class
file for the interface and can't find it.

How can I get the compiler to generate the .class file?

Is this an interface that's part of JUnit?

• org.junit.runner.Describable
• org.junit.runner.manipulation.Filterable
• org.junit.runner.manipulation.Sortable

If so, you need to include JUnit's location in the classpath, as
discussed here:

<http://junit.sourceforge.net/doc/faq/faq.htm>
 
M

Mark Spezzano

No, it's the application's interface file, not from Junit.

Isn't it abnormal for a java file (even interfaces) not to be
compiled?
 
J

John B. Matthews

No, it's the application's interface file, not from Junit.

Perhaps the IDE is has found a matching interface elsewhere, rather than
where you (or the command line) are looking.
Isn't it abnormal for a java file (even interfaces) not to be
compiled?

If the Java source of an interface is compiled, it should produce a
corresponding class file; but there are myriad ways to include the
wrong source or exclude the right one.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top