This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Runtime Error.... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Runtime Error...." Watch "Runtime Error...." New topic
Author

Runtime Error....

yunuss khan
Greenhorn

Joined: Apr 22, 2006
Posts: 17
Hi All,

while running the code i m getting an error at run time.

error is

"Exception in thread "main" java.lang.noClassdeffoundError:Room1"

room1 is my class name.

pls help

Thanks * Regards,
john
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

Well, first: is the class name "Room1" or "room1"? Java cares -- it's case sensitive. Make sure you're typing the right one.

Have you compiled your class? In other words, is there now a file called Room1.class?

If all this is straightened out, then you may have a bad CLASSPATH setting. Try this:

java -cp . Room1

that's "java space dash cp space dot space Room1". That should work!


[Jess in Action][AskingGoodQuestions]
Shaan Shar
Ranch Hand

Joined: Dec 27, 2005
Posts: 1249

Originally posted by yunuss khan:
Hi All,

while running the code i m getting an error at run time.

error is

"Exception in thread "main" java.lang.noClassdeffoundError:Room1"

room1 is my class name.

pls help

Thanks * Regards,
john


What are you giving at console as an Input...

room1 is my class name


and exception is

"Exception in thread "main" java.lang.noClassdeffoundError:Room1"


That mean you are typing

java Room1


you must try

java room1

Hope this helps.... If still any concern then revert with exact details.. what are you using....exactly...


The Best way to predict your future is to create it - Every great individual common man
yunuss khan
Greenhorn

Joined: Apr 22, 2006
Posts: 17
Hi Ernest,

thanks for your help.. can you please let me know how can i set the classpath or path pernamently.

on command prompt i m typind c:\jdk1.5.0_06\bin

pls help,

Regards,
yunus
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

See http://faq.javaranch.com/view?HowToSetTheClassPath

Pay special attention to the part that suggests not setting it at all! If you do choose to set it to something make sure "." (dot) is included.
 
Don't get me started about those stupid light bulbs.
 
subject: Runtime Error....