Go here to get a better explaintion than my simple answer. I had this error and I looked all over online in many many forums. I then went back to my textbooks website which gave me the above page.
You can do two things

When compiling the fiile type javac -classpath .
when you go to run the program type java -classpath . yourfilename
You MUST add the space . space inbetween -crosspath and what you named your file.

It talks that you can change having to type the -classpah by eliminating the variable crosspath. I wouldn't mind doing that if I knew how to get the variable back if my computer objects. I don't liike to delete things if I don't know how to get it back or I definantly don't want it.

If this works for you pass it on to any forums you see.



I'm trying to run my program in command prompt, but i get this error:

Exception in thread "main" java.lang.NoClassDefFoundError: Invaders

Can anybody tell me what this error means?


Recommended Answers

All 2 Replies

Says it all really, it can't find the class.
What part of "No Classdef(inition) Found Error" don't you understand?

import java.sql.*;

class Student1
    public static void Main(String[] ar)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.