This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes NoClassDefFoundError error Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "NoClassDefFoundError error" Watch "NoClassDefFoundError error" New topic
Author

NoClassDefFoundError error

pramod talekar
Ranch Hand

Joined: Apr 26, 2010
Posts: 316

Hello,

I have created a .class file from a .java file on my desktop (C:\Documents and Settings\ptalek\Desktop\MyFirstJava.java) & (C:\Documents and Settings\ptalek\Desktop\MyFirstJava.class).

Below is the code for MyFirstJava.



But I'm unable to run this program using the java command.

I'm using following commands in the command prompt:



I got the below error :



Please advise.


Thanks,
Pramod
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Use java -cp . MyFirstJava .

and dont use desktop , it troubles you after sometime.
Wim Vanni
Ranch Hand

Joined: Apr 06, 2011
Posts: 96

Typical classpath problem indeed. Check the JavaRanch FAQ. This document and others will surely help you avoid many pitfalls. Then again, stepping into pitfalls means you have to get out of them and that learning process is good for you

Cheers,
Wim
pramod talekar
Ranch Hand

Joined: Apr 26, 2010
Posts: 316

Thanks Seetharaman & Wim.

It's working now.
The doc I'm referring to doesn't show this classpath statement

Thank you so much.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: NoClassDefFoundError error
 
Similar Threads
j2ee command is not working
NoClassDefFoundError
Compiling multiple source files
Java Error: java.lang.ArrayIndexOutOfBoundsException: 0 For Simple Program
How to read xlsx file from local java file