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 392,057 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 4,244 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: 99099 | Replies: 58
Reply
Join Date: Aug 2004
Location: Los Angeles
Posts: 343
Reputation: Ghost is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 2
Ghost's Avatar
Ghost Ghost is offline Offline
Posting Whiz

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

  #21  
Jun 4th, 2005
first, i need to apoligize for not responding sooner. I've been studying and taking Finals all of last week. They're finally over!!!!!!

second, i changed the variables and it worked!

third, the program I'm compiling has 8 .java files. which do i compile first?

server_crash, thank you so much for your help.
CRD
Join the CRD forums! If you're one of the first 4 people to post in a topic, you get FREE web hosting with:
Apache WWW Host
Unlimited (within reason) storage
Unlimited (within reason) bandwith
PHP
mySQL
FTP
Unlimited Subdomains Hosted
Unlimited Domains Hosted

ALL FREE!!

Click here to visit
Reply With Quote  
Join Date: Jun 2004
Location: H4x0rville
Posts: 2,105
Reputation: server_crash is on a distinguished road 
Rep Power: 9
Solved Threads: 18
server_crash's Avatar
server_crash server_crash is offline Offline
Postaholic

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

  #22  
Jun 4th, 2005
Shhewww, that's a lot of work..8 files.

It will be hard to tell what to compile first. You'll need to find the file that calls no other classes. Since I don't know the code or anything, I think the best thing for you, is to compile everyone of them until you don't get an error. You should get an error on the ones that call other classes that aren't compiled. Then once you get one of them compiled, start the process over!
Reply With Quote  
Join Date: Jun 2004
Location: H4x0rville
Posts: 2,105
Reputation: server_crash is on a distinguished road 
Rep Power: 9
Solved Threads: 18
server_crash's Avatar
server_crash server_crash is offline Offline
Postaholic

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

  #23  
Jun 4th, 2005
Originally Posted by C++
server_crash, thank you so much for your help.

No problem. Your very hard working, and I don't mind helping out such a person. By the way, how did you do on your finals?
Reply With Quote  
Join Date: Aug 2004
Location: Los Angeles
Posts: 343
Reputation: Ghost is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 2
Ghost's Avatar
Ghost Ghost is offline Offline
Posting Whiz

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

  #24  
Jun 4th, 2005
I got an A- on my math final but i dunno about the others - I get them back on wednesday
CRD
Join the CRD forums! If you're one of the first 4 people to post in a topic, you get FREE web hosting with:
Apache WWW Host
Unlimited (within reason) storage
Unlimited (within reason) bandwith
PHP
mySQL
FTP
Unlimited Subdomains Hosted
Unlimited Domains Hosted

ALL FREE!!

Click here to visit
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

  #25  
Jun 10th, 2005
Originally Posted by server_crash
Yes. 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! Naturally it should be in the same folder as the source, but since your getting that error, let's hope it's not. If it is in the same folder, then we got some problems with the classpath which will be harder to fix.

I had the same problem as above, and I DO have the .class folder and the .java folder in the same place - in my C: drive. Also, I have the path pointing to the bin folder where the compiler in.

It compiled fine (created the .class folder), and now it won't run.
Please help!
Reply With Quote  
Join Date: Jun 2004
Location: H4x0rville
Posts: 2,105
Reputation: server_crash is on a distinguished road 
Rep Power: 9
Solved Threads: 18
server_crash's Avatar
server_crash server_crash is offline Offline
Postaholic

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

  #26  
Jun 10th, 2005
Using an IDE or the Command line?
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

  #27  
Jun 10th, 2005
Originally Posted by server_crash
Using an IDE or the Command line?
Wow - that was a fast reply - using Command line. Is there an easier way?
Reply With Quote  
Join Date: Jun 2004
Location: H4x0rville
Posts: 2,105
Reputation: server_crash is on a distinguished road 
Rep Power: 9
Solved Threads: 18
server_crash's Avatar
server_crash server_crash is offline Offline
Postaholic

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

  #28  
Jun 10th, 2005
If you're starting out, I would stick with the command line for a bit. It probably is the classpath, altough you set it. The classpath can be very hard to set, and usually you won't get it the first time.
Please post your current classpath so that I can take a look at what you have.
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

  #29  
Jun 10th, 2005
Originally Posted by server_crash
If you're starting out, I would stick with the command line for a bit. It probably is the classpath, altough you set it. The classpath can be very hard to set, and usually you won't get it the first time.
Please post your current classpath so that I can take a look at what you have.
"C\QTJava.zip"
I think this must be wrong... do you need my regular path too?
Reply With Quote  
Join Date: Jun 2004
Location: H4x0rville
Posts: 2,105
Reputation: server_crash is on a distinguished road 
Rep Power: 9
Solved Threads: 18
server_crash's Avatar
server_crash server_crash is offline Offline
Postaholic

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

  #30  
Jun 10th, 2005
I HOPE that's not your classpath!!!! :lol:
It should poin to the tools.jar file in your jdk directory:

Something along the lines of this:
C\Program Files\Java\jdk1.5.0\lib\tools.jar

Take a look at this, this was one of my earlier posts.


Originally Posted by server_crash
Ok, since your using the command prompt I can help you even more, because that's what I use. First of all, you need to create a folder on the C drive, and name it whatever you want. This is the folder you'll put all of your source files, class files, and miscelaneous files in.

Now to the environment variables:

Considering you have windows:

Goto start--->right click on my computer--->select properties
Goto the advanced tab, and you should see a button at the bottom that says environment variables...click on that.

The only thing you need to worry about is the PATH variable, and the CLASSPATH variable, nothing else.

SKIP THIS STEP AND GO ON TO THE CLASSPATH, IF IT DOESN'T WORK AFTER SETTING THE CLASSPATH, THEN COME BACK AND SET THIS.
The path variable must point to the bin folder in the sun app server, and the bin folder in the jdk directory. Now, those are two different directories, so you seperate them with a semicolon when creating it. Here is what mine looks like:

C:\Sun\AppServer\bin;C:\Program Files\Java\jdk1.5.0\bin




Classpath....This points to the tools.jar file in the jdk directory. It's pretty easy to find. Here is what mine looks like:

.;%classpath%.;C\Program Files\Java\jdk1.5.0\lib\tools.jar

Your's will look similar, although you do not need the .;%classpath%.; statement.


Next, you need to know how to access your files at the command line.

To do so, you simply type cd/folderName at the command line. The cd stands for current directory. My folder was named javawork, so to access it, I did this at the command prompt:

cd/javawork // brings me to the right directory
javac Hello.java //compiles my program
java Hello //runs my program


Let me know if you don't undestand something or need more help.
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 11:40 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC