Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Linking Error Message, What does it mean?

Status
Not open for further replies.

stevemei

Programmer
Mar 18, 2001
5
US
What does it mean when they tell me this after i link it:
Exception in thread "main" java.lang.NoClassDefFoundError: Studentscore/java

Studentscore is my file name. I javac it and it works but when i java Studentscore.java, it sends me above message.

What does it mean?

Your help is appreciated much
 
For executing java files you only state the base of the file like:

Java Studentcore

Greetings,
Steven.
 
i just try what u said
java Studentscore
and it responds with the same error and more

this is what i already have:

/* Uses an array of arrays.
* Computes the average score of
* each student.
*/

import iopack.Io;
class StudentScore {
public static void main(String [] args) {
int [][]student = {{52, 76, 65},{98, 87, 93},{43, 77, 62},{72, 73, 74}}; // scores
double sum; // sum of the scores for each student
for (int i=0; i<student.length; i++) {
sum = 0;
for (int j=0; j<student.length; j++)
sum += student[j];
System.out.print(&quot;The average score for student &quot; + i + &quot; is &quot;);
Io.println(sum/student.length,1);
}
}
}
 
It looks like your class path is not set right. What are you using windows 98 or are you a NT system?

The way to set the class path in above systems is different. But what you put in the class path is the same.

Go into the autoexec.bat file and look at your classpath.

It should look something like set classpath=c:\Your file directory.

Now in the above file directory put your .class file in there and it should run.
 
or use the -classpath parameter to the java exe.

java -classpath c:\classes StudentScore

where StudentScore.class is in c:\classes

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top