• Post Reply Bookmark Topic Watch Topic
  • New Topic

I got an runtime exception (NoClassDefFoundError) when running this code,but it compiles good.  RSS feed

 
Gnanaprakash Venugopal
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Hi Friends , can anyone resolve this Problem:


Java identifiers are case sensitive. identifier WELL is differ from Well. but i got a runtime exception while running this program: please tel me why its happened.

Well.java

class WELL
{
WELL()
{
System.out.println("WELL is invoked");
}
}

class Well
{
Well()
{
System.out.println("Well is invoked");
}
public static void main(String...as)
{

new Well();
new WELL();
}
}

 
harshvardhan ojha
Ranch Hand
Posts: 157
1
Android Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you cant define same types(classes or interface) in the same package with same name.
As you declared both in one file class loader is having problem identifying the right one even if you will make Well class public.
 
Darryl Burke
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java is case sensitive, but your OS isn't. In Windows, you can't have two files named WELL.class and Well.class in the same folder.

The code you posted runs just fine under Linux.
 
Gnanaprakash Venugopal
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


i have understood now..

Thank you....Darryl Burke


 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!