java - NoClassDefFoundError -


i have issue noclasdeffounderror being thrown. puzzles me since using interfaces, , no class definition should available. have read through posts point classpath, don't believe issue here (although may wrong). using netbeans 6.9.1 ide.

i have created sample setup reproduce issue. 4 projects: interfaces, objects, locator , consumer. below find implementations.

at runtime consumer coplains missing someobject implementation, should not aware of since accepting interface.

exception in thread "main" java.lang.noclassdeffounderror: objects/someobject

what missing?

package interfaces; public interface isomeinterface { }  package objects; import interfaces.isomeinterface; public class someobject implements isomeinterface{ }  package locator; import interfaces.isomeinterface; import objects.someobject; public class locator { public static isomeinterface locateimplementation() { return new someobject(); }}  package consumer; import interfaces.isomeinterface; import locator.locator; public class main { public static void main(string[] args) { isomeinterface object = locator.locateimplementation(); }} 

you can noclassdeffounderror exception interfaces can classes. consider "class" in name of exception .class file generated compiling class or interface, not java class.

this saying class/interface objects.someobject isn't visible on classpath. check location of .class file , ensure it's on classpath - if you're positive it's there, give screen shots or might debug problem.


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -