• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

interface

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
file name askme.java; saving this file in the bin folder.


compiling using c:\java\jdk1.6.0\bin> javac askme.java compiled successfully ;
run using c:\java\jdk1.6.0\bin> java AskMe
error-
exception in thread "main" java.lang.noclassdeffounderror: AskMe;

how to solve this suggest me thankyou
 
Ranch Hand
Posts: 859
IBM DB2 Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Case Sensitive!

askme is NOT the same as AskMe

Pat.
 
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

javac askme.java compiled successfully


 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Plus, Constant Interface is an Anti pattern-why? search here...remember many times discussed here...
 
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is this for a school assignment where you must do things this way? If not, you should be using enums rather than constants.
 
deepak prashad
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i know case sensitive also when compiling c:\java\jdk1.6.0\bin> javac AskMe.java no problem during compilation.
but at run time c:\java\jdk1.6.0\bin> java AskMe
error-
exception in thread "main" java .lang.noclassdeffounderror;

arises even with all programing when i am compiling no error but at run time same error mention above while i run same class before it run successfully;
 
William P O'Sullivan
Ranch Hand
Posts: 859
IBM DB2 Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is CLASSPATH environment variable set?

do a dir, are you sure the AskMe.class exists?

Why are you putting source in the Java bin (system folder)?

These classes are in one file?

Split them out into AskMe,java, SharedConstants.java and Question.java. Compile each one and ensure .class files exist.

This is what I get from a command line, running a small Java app.



Which works, no CLASSPATH, nothing.

c:\Users\osullivanw\workspace\wposStuff\bin>dir RunMe*
Volume in drive C has no label.
Volume Serial Number is 30B6-DDBB

Directory of c:\Users\osullivanw\workspace\wposStuff\bin

04/03/2012 02:23 PM 8,167 RunMeForSql.class
1 File(s) 8,167 bytes
0 Dir(s) 247,761,305,600 bytes free

Pat.


 
deepak prashad
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
file name Example.java and saving this file in bin folder.
class Example {
// Your program begins with a call to main().
public static void main(String args[]) {
System.out.println("This is a simple Java program.");
}
}
c:\java\jdk1.6.0\bin> javac Example.java; no error
c:\java\jdk1.6.0\bin> java Example;
error-
eeception in thread "main" java.lang.noclassdeffounderror: Example;
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
any package to your class?
 
William P O'Sullivan
Ranch Hand
Posts: 859
IBM DB2 Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


c:\Users\osullivanw\workspace\wposStuff\bin>dir *.class
Volume in drive C has no label.
Volume Serial Number is 30B6-DDBB

Directory of c:\Users\osullivanw\workspace\wposStuff\bin

04/03/2012 03:05 PM 974 AskMe.class
04/03/2012 03:05 PM 605 Question.class
04/03/2012 03:05 PM 299 SharedConstants.class
21 File(s) 53,623 bytes
0 Dir(s) 247,760,510,976 bytes free

c:\Users\osullivanw\workspace\wposStuff\bin>

Even with one file AskMe.java, it runs fine:
 
deepak prashad
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes AskMe.class exist in the bin folder after compiling
 
deepak prashad
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i am using class without package
 
deepak prashad
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
C:\Users\abhijeet\Java\jdk1.6.0\bin>dir *.class
Volume in drive C has no label.
Volume Serial Number is B27F-753E

Directory of C:\Users\abhijeet\Java\jdk1.6.0\bin

04/03/2012 02:13 PM 813 AskMe.class
04/03/2012 01:33 PM 438 Example.class
04/03/2012 02:13 PM 500 Question.class
04/03/2012 02:13 PM 289 SharedConstants.class
4 File(s) 2,040 bytes
0 Dir(s) 57,515,016,192 bytes free

C:\Users\abhijeet\Java\jdk1.6.0\bin>java AskMe
Exception in thread "main" java.lang.NoClassDefFoundError: AskMe
C:\Users\abhijeet\Java\jdk1.6.0\bin>java Example
Exception in thread "main" java.lang.NoClassDefFoundError: Example

i am so tensed please help me to solve this problem
 
Marshal
Posts: 79931
396
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Seetharaman Venkatasamy wrote:

javac askme.java compiled successfully


On Windows®, the OS can pass the argument to javac in a case-insensitive fashion.
 
It is an experimental device that will make my mind that most powerful force on earth! More powerful than this tiny ad!
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic