Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NoClassDefFoundError

 
seetharaman jayaraman
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
my class file "Hello.class" is inside the package "rmi".
"rmi" folder is in c:
I am getting NoClassDefFoundError while executing "Hello" from c:> or from c:\rmi>
I tried setting classpath as %classpath%;c:\; and %classpath%;c:\rmi\; etc
but i could not solve the problem
The code of Hello.java is as:
public class Hello
{
public static void main(String a[])
{
System.out.println("hei");
}
}

please help
all the best and advance thanks.

Added on 30.04.2008 only like java rmi.Hello works, it seems no way to use like java Hello
[ April 30, 2008: Message edited by: seetharaman jayaraman ]
 
Amit Ghorpade
Bartender
Posts: 2854
10
Fedora Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am getting NoClassDefFoundError while executing "Hello" from c:> or from c:\rmi>

I guess you have not compiled Hello.java, hence the error.
And to execute the program you need to say java Hello and not just "Hello"


Hope this helps
 
Campbell Ritchie
Sheriff
Pie
Posts: 48954
60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
. . . and have you got ;. or ;.; or .; anywhere in your classpath? On windows you ought to have at least one of those three (though it doesn't seem to do any harm to have all three!).
 
Charlie Newman
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have just started this game too. I've found that Windows XP does not like the "%" at all. Also, if you go and change your path, close your command promt. I hope this help some.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI ram,

better you set classpath in your envoronment variable...give java class file folder path to the classpath..

thanks & regards,
seetharaman
 
Campbell Ritchie
Sheriff
Pie
Posts: 48954
60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by seetharam venk:
HI ram,

better you set classpath in your envoronment variable...give java class file folder path to the classpath..

thanks & regards,
seetharaman
Disagree. You want the folder with java.exe (for Windows) to be in the PATH, and you want a . for current directory in your classpath. Any classpath setting can be left for more advanced programming, and you can do that from the command line or a manifest file in a .jar.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Campbell Ritchie,

well, to use javac,you need path variable right?..i was saying about to run a java file(i.e,to use java) you need classpath..

thanks & regards,
seetharaman
 
Campbell Ritchie
Sheriff
Pie
Posts: 48954
60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You usually only need to set the classpath if you have executable .class files in several folders. So, you don't usually need to set the classpath for executing simple Java applications.
You virtually always need the PATH set to get anything to execute.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic