cant run a program from command prompt

i am using eclipse 3.2 for java development.programs are running from editor window, but whenever i am trying to run it from command prmpt , i am getting folowing error.............NoClassDefinitionFoundhow to resolve it...?regardsyogesh g k
[283 byte] By [Yogesh.Turoc3a] at [2007-11-26 16:47:42]
# 1
Set your classpath. And don't even dare asking more questions otherwise you will receive a right royal flamin!!Ted.
ted_trippina at 2007-7-8 23:15:12 > top of Java-index,Java Essentials,New To Java...
# 2
run it using java -cp . packagename.className
Peetzorea at 2007-7-8 23:15:12 > top of Java-index,Java Essentials,New To Java...
# 3
Tedif classpath having not been set, how its possible for it to run from eclipse.read question again
Yogesh.Turoc3a at 2007-7-8 23:15:12 > top of Java-index,Java Essentials,New To Java...
# 4

> if classpath having not been set, how its possible

> for it to run from eclipse.

> read question again

Eclipse temporarily makes a classpath environment variable prior to the running of your program, and deletes that classpath after the run.. Same with NetBeans and others..

If you want to compile from the prompt, you'll need to manually tell java where the classpath is, and that is done by (as stated above):

java -cp "classpathdir" "classname"

Tribioa at 2007-7-8 23:15:12 > top of Java-index,Java Essentials,New To Java...
# 5

> Ted

>

> if classpath having not been set, how its possible

> for it to run from eclipse.

> read question again

Ok, I read the question again. I came to the following conclusion; you are a fool.

Not only have you not bothered to do any searching for your problem but have also blatantly ignore the exception you received which tells you that the class can not be found on the classpath, ie. classpath not set or incomplete!!!!!

At least tribio is prepared to tend to the needs of fools.

Ted.

ted_trippina at 2007-7-8 23:15:12 > top of Java-index,Java Essentials,New To Java...
# 6
Yet another example of why you should not learn any programming language using an IDE. Use a simple text editor and the command line until you understand what is going on "behind the scenes", then you can start to use an IDE.
masijade.a at 2007-7-8 23:15:12 > top of Java-index,Java Essentials,New To Java...
# 7

Since there have been a lot of posts from people who fail to compile and run their correct code, I would like to suggest to use ant for building and running! It hides the complexities of specifying the correct paths and a lot it's easier to type

prompt>ant

at the command line than

prompt>javac -d . -cp .;longListOfJarsNeededToRun somePackage/*.java aLotOfOtherFilesToCompile.java

prompt>java -cp .;longListOfJarsNeededToRun somePackage.someClass

It takes some time to get familiar with the configuration, but once you get it right, you gain back a lot of your invested time!

Peetzorea at 2007-7-8 23:15:12 > top of Java-index,Java Essentials,New To Java...