User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Java section within the Software Development category of DaniWeb, a massive community of 397,834 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,519 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Java advertiser: Lunarpages Java Web Hosting
Views: 99666 | Replies: 58
Reply
Join Date: Apr 2006
Posts: 6
Reputation: SRWenner is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
SRWenner SRWenner is offline Offline
Newbie Poster

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

  #51  
Apr 1st, 2006
Originally Posted by server_crash
Actuallly, when you find the folder containing the source file(.java), you should notice the .class file is not in that same folder. If it is, then we have problems!

Hi, I'm a brand new newbie following this thread with great interest. I can run the "HelloWorldApp" just fine at the DOS command line; but, I want to learn to use NetBeans IDE. When I plug HelloWorldApp.java into NetBeans it compiles successfully into the same folder; however, when I try to run I get the above error message, followed by the encouragement "BUILD SUCCESSFUL" (no "HelloWorld" output, however). I've tried futzing around with the classpath stuff till I'm blue in the face! It can't be this hard! Any ideas?
Thanks
Reply With Quote  
Join Date: Apr 2006
Posts: 6
Reputation: SRWenner is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
SRWenner SRWenner is offline Offline
Newbie Poster

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

  #52  
Apr 1st, 2006
Guys, I finally got "HelloWorldApp" to work from within NetBeans IDE. It appears my problem was that I had put both HelloWorldApp.java and HelloWorldApp.class (from an earlier DOS prompt compile) directly into the project path. Therefore, when I ran the code within NetBeans I got a new "build" with only the compiled code, and not the source; I was confused because my original source and class file were still together in their original place - so I didn't understand why Java couldn't find the source. Anyway, I obviously have a lot to learn! If anyone can suggest a way I can clear up my considerable confusion about how this all works, I would be eternally gratefull!
Reply With Quote  
Join Date: Jun 2006
Posts: 1
Reputation: superwazn is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
superwazn superwazn is offline Offline
Newbie Poster

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

  #53  
Jun 3rd, 2006
hi i am getting this error too but i dont use command line (and dont plan to) im using textPad, and i installed it after i installed the jdk, so even after reading these helpful post i still dont understand where my problem is. the .java file is in the same folder as the .class. im not that new to java, but i've just begun to work at home and am unfamilier with setting up the editor and such to make it work (at school it was already good to go)
Reply With Quote  
Join Date: Mar 2006
Posts: 4
Reputation: sachitha is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
sachitha sachitha is offline Offline
Newbie Poster

Question Re: Exception in thread "main" java.lang.NoClassDefFoundError: Invaders Error

  #54  
Aug 4th, 2006
Hey all,
i'm kinda having this same problem.. in fact i'm just trying to run in the DOS prompt. Codings written for Applets (appletviewer sach.html ) run perfectly in dos prompt, after i set the Classpath n all.

But, a simple java program, gives me this same error , when i try to run using >>java Sach
after successfully compiling using javac..
Exception in thread "main" java.lang.NoClassDefFoundError: Sach

i set my classpath to the following
path=C:\Program Files\Java\jdk1.5.0_05\bin
(btw, i guess this sounds correct ya? coz ,well the javac command works fine. It doesn't even give any compile errors).

i hope someone can help me out plz. it's really confusing..

Regards,
Sachitha
Reply With Quote  
Join Date: Jun 2005
Posts: 14
Reputation: rpratt is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
rpratt rpratt is offline Offline
Newbie Poster

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

  #55  
Aug 4th, 2006
It looks like you have set the PATH but NOT the CLASSPATH.

For CLASSPATH - just put a period in as the variable. Really. It's weird, but it works.

If you're not sure how to do this, let me know.

Good luck!


PS You might want to try to install JCreator instead - it's free, and you don't have to do all this nonsense - I don't think.
Reply With Quote  
Join Date: Mar 2006
Posts: 4
Reputation: sachitha is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
sachitha sachitha is offline Offline
Newbie Poster

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

  #56  
Aug 5th, 2006
i set the PATH and CLASSPATH using the following link which was posted in this page itself
(http://www.cs.ucsb.edu/~teliot/Path_and_Classpath.htm )
but that's for jdk 1.5.0_02, but i'm having jdk 1.5.0_05...
i gave for the CLASSPATH a . (a fullstop)
Now how do i run programs in the Command prompt???
i just did like this...
javac <program>.java //now this worked without a problem

when i gave
java <program> //it gives the following error

Exception in "main" java.lang.UnsupportedClassVersion error
....etc etc...

plz tell me wut i should do , n why do i get such an error...
Reply With Quote  
Join Date: Mar 2006
Posts: 4
Reputation: sachitha is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
sachitha sachitha is offline Offline
Newbie Poster

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

  #57  
Aug 6th, 2006
hey i kinda figured out a way to run simple java program (like hello world..)
set classpath=.
set path=.......\bin

but this program with packages n all wont work.. it compiles , but cant run
can someone plz tell me why???
i get the following error when i start to run with java command

Exception in thread "main" java.lang.NullPointerException

why is that?
Reply With Quote  
Join Date: Aug 2006
Posts: 1
Reputation: dir is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
dir dir is offline Offline
Newbie Poster

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

  #58  
Aug 23rd, 2006
My command prompt doesn't recognize neither CLASSPATH nor JAVA_HOME commands...I've already set the path variable but when i'm goiong to set the classpath and java_home variables it says that they are not recognized as an intern or extern command etc...
Could anyone please help me?

(I'm portuguese; sorry for my english...)
Last edited by dir : Aug 23rd, 2006 at 8:11 pm.
Reply With Quote  
Join Date: Aug 2005
Location: Socialist Republic of Boulder
Posts: 216
Reputation: hooknc is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 6
hooknc hooknc is offline Offline
Posting Whiz in Training

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

  #59  
Aug 23rd, 2006
type 'set CLASSPATH' and 'set JAVA_HOME' instead. CLASSPATH and JAVA_HOME are not commands they are system varables.

(You also should have stared your own thread instead of adding onto this one.)
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb Java Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the Java Forum

All times are GMT -4. The time now is 7:26 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC