please help-Exception in thread "main" java.lang.NoClassDefFoundError:
please help me, before we formatted the computer, the java was working good , but after we format it, everytime i run a program, it shows a message:
Exception in thread "main" java.lang.NoClassDefFoundError:
i am working on a windows environment
also my friend has the same problem(after formatting)
any help i would be so thankful...
[374 byte] By [
l247joa] at [2007-10-3 9:21:55]

how are starting the program?
what are you mean by"how are starting the program? "
> what are you mean by"how are starting the program?"He meant "How are you starting the program?"You could get the answer if you typed that error message into google or the search box on the left side of your screen.
--this is a program:
public class Stjerner
{
public static void main (String[] args)
{
final int max = 10;
for (int row = 1; row <= max; row++)
{
for (int star = 1; star <= row; star++)
System.out.print ("*");
System.out.println();
}
}
}
> Runs fine for me.Its not a problem with his program. OP, re-read reply #3.
i know it runs fine, all programs i run show this message, there is nothing wrong with the code... plz help?
> > Runs fine for me.
>
> Its not a problem with his program. OP, re-read
> reply #3.
I read that. But I thought the OP didn't realize that because he posted the code, and since that is not the problem why would he post the code?
So I was letting him know that the code was not the problem.
> i know it runs fine, all programs i run show this
> message, there is nothing wrong with the code... plz
> help?
Presumably you are using a console window to run it.
What is the exact output when you run the following from the console window...
java -version
>Presumably you are using a console window to run it..What is the exact output when you run the following from the console >window...>java -version i don't know what you mean by that?!
> >Presumably you are using a console window to run
> it.
>
> .What is the exact output when you run the following
> from the console >window...
>
> >java -version
>
> i don't know what you mean by that?!
Then we are back to you explaining exactly how you are starting the application. You need to fill in the following....
1. Computer is turned on and OS boots.
2. <Fill in here>
....
X. In the <Fill in description of where it is> the following error message <Fill in entire message>
is anybody willing to help me?
> is anybody willing to help me?Not anymore.
how do you run the program? and what errors do you get other then the one you listed. if you cant figure out what my question means, then you shouldnt try to program computers, since you obviously dont know the basics
> is anybody willing to help me?We are all trying to help. What more do you want? For us to fly over to your location and solve it for you?Sorry, you are pushing people away with this statement.
zadoka at 2007-7-21 12:45:55 >

thank you anyway. i am just a beginner
i don't have errors when i compile, i get this message at run time
FOR THE LOVE OF GOD AND ALL THAT IS HOLY, WHAT COMMAND DO YOU USE TO RUN THE PROGRAM?!
> i don't have errors when i compile, i get this> message at run timeIn order to get to runtime you had to have typed something or pressed some button on some IDE - we are asking what you did to run your program.
tsitha at 2007-7-21 12:45:55 >

> i don't have errors when i compile, i get this> message at run timeWe know. That is why all of our questions where about how you where running it.
zadoka at 2007-7-21 12:45:55 >

> ok ok, i use
> ctrl+2
In some IDE, I assume (just out of curiosity - why wouldn't you think that when people are repeatedly asking you how you start your program that you might mention the fact that you start it from an IDE?) So somewhere in the preferences/options of your IDE you probably tell it things like your CLASSPATH settings - make sure you add the current directory to that (".")
tsitha at 2007-7-21 12:45:55 >

> ok ok, i use > ctrl+2In what? Eclipse? Netbeans? JCreator?
ok, now we are getting somewhere.
go into textpad and find out what the ctl-2 command actually does.
paste that text into here.
also, go check and see if you have .class files that are created for this project.
they should have the same names as the java files, so you can use find
ctrl+2 Run java applicationand there are files were created, the type of them is (MS-DOS Batch File) not .class
ok, you have 2 problems:your java code does not compile into class files, so therefor you have no program to run.you have no idea what goes on behind the scenes
> ctrl+2 Run java application
That pops a console window. It has a complete message in it which not only says NoClassDefFoundError but also has text after that.
What does the text after that say?
And I would suggest that you stop trying to use TextPad to run it and instead use a real console window which you can find under 'start'->'run' (type 'cmd') in windows.
In TextPAd, go to Wind -> Preferences then browse down to Tools-> Run Java Application.On teh Parameters line, put in your classpath as -cp .;<path to you classes dir>;