954,554 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

exception in thread "main" java.lang.NoClassDefFoundError

http://www.deitel.com/books/jHTP5/jHTP5_faq.html#compile%20servlet

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 . yourfilenam.java
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.

Mary

Hi,

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?

Thanx.

bert2020
Newbie Poster
1 post since Sep 2005
Reputation Points: 10
Solved Threads: 0
 

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

jwenting
duckman
Team Colleague
8,392 posts since Nov 2004
Reputation Points: 1,662
Solved Threads: 337
 

import java.sql.*;

class Student1
{
public static void Main(String[] ar)
{
try
{
Class.forName(

satija_tarun
Newbie Poster
1 post since Jul 2010
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You