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 391,591 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,700 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: 99040 | Replies: 58
Reply
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

  #11  
May 25th, 2005
Originally Posted by C++
server_crash, there's an option called "Output Path" you can change. Is this what I'm looking for?

That's exactly what your looking for. Now, go find the directory where the source file is, and set the output to that directory.
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

  #12  
May 25th, 2005
server_crash, the source files r the .java files - correct?

thanx again for all 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

  #13  
May 25th, 2005
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.
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

  #14  
May 26th, 2005
Things work out ok?
Reply With Quote  
Join Date: May 2005
Location: Digos City,Philippines
Posts: 2
Reputation: woodpusher is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
woodpusher woodpusher is offline Offline
Newbie Poster

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

  #15  
May 26th, 2005
Hi,
Make it sure that your in correct path,make sure also that you've compiled
your java source file(s) -(.java).

Hint:at the dos prompt- ex. assuming that your in the directory D:\javafiles just.Type d:\javafiles\d:\j2sdk1.5.0\bin\javac fileName.java.

-email link removed. Please follow up discussions in the forum thread only - Catweazle

Thatz all folks.
Last edited by Catweazle : May 29th, 2005 at 3:29 am.
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

  #16  
May 26th, 2005
actually, when i change the path on jbuilder, it saves the files to the same place. can i copy and paste them to the same folder? another thing's weird: when i type javac, it says it's an unrecognizable command, but when i type java, it works
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

  #17  
May 26th, 2005
Ok, you can try to copy and paste the class file into the right directory and try running it. That would probably work, but it wont fix the problem.

You said something about the javac command? Are you using the command line? If so, that error is the result of your environment variables not being set correctly.
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

  #18  
May 27th, 2005
server_crash, first, I want to thank you for helping me so much with this problem.

You said something about the javac command? Are you using the command line? If so, that error is the result of your environment variables not being set correctly.
I'm using command prompt. is there a way to change those variables? Also, i created the class files with jbuilder, not console.

Ok, you can try to copy and paste the class file into the right directory and try running it. That would probably work, but it wont fix the problem.
If I copy and paste the files, is there a certain folder name I need. Also, my program has multiple classes. I compile the one with the main method... correct? Last, Should I put all of the sound and picture files in that folder also?

Thank you SO much!
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

  #19  
May 27th, 2005
Originally Posted by C++
server_crash, first, I want to thank you for helping me so much with this problem.

Your very welcome. I love helping people such as you who are so appreciative and hard working. Keep up the good work!
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

  #20  
May 27th, 2005
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:23 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC