Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Runtime Error....

 
yunuss khan
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
Shaan Shar
Ranch Hand
Posts: 1249
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
yunuss khan
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic