| Author |
NoClassDefFoundError
|
seetharaman jayaraman
Ranch Hand
Joined: Feb 18, 2008
Posts: 42
|
|
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
Joined: Jun 06, 2007
Posts: 2561
|
|
Hi,
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
|
SCJP, SCWCD.
|Asking Good Questions|
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32827
|
|
|
. . . 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
Joined: Apr 22, 2008
Posts: 4
|
|
|
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
Joined: Jan 28, 2008
Posts: 5575
|
|
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
Joined: Oct 13, 2005
Posts: 32827
|
|
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
Joined: Jan 28, 2008
Posts: 5575
|
|
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
Joined: Oct 13, 2005
Posts: 32827
|
|
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.
|
 |
 |
|
|
subject: NoClassDefFoundError
|
|
|