aspose file tools*
The moose likes Beginning Java and the fly likes interface Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "interface" Watch "interface" New topic
Author

interface

deepak prashad
Greenhorn

Joined: Mar 27, 2012
Posts: 7
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
William P O'Sullivan
Ranch Hand

Joined: Mar 28, 2012
Posts: 859

Case Sensitive!

askme is NOT the same as AskMe

Pat.
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

javac askme.java compiled successfully

Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Plus, Constant Interface is an Anti pattern-why? search here...remember many times discussed here...
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61232
    
  66

Is this for a school assignment where you must do things this way? If not, you should be using enums rather than constants.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
deepak prashad
Greenhorn

Joined: Mar 27, 2012
Posts: 7
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

Joined: Mar 28, 2012
Posts: 859

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

Joined: Mar 27, 2012
Posts: 7
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

Joined: Jan 28, 2008
Posts: 5575

any package to your class?
William P O'Sullivan
Ranch Hand

Joined: Mar 28, 2012
Posts: 859



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

Joined: Mar 27, 2012
Posts: 7
yes AskMe.class exist in the bin folder after compiling
deepak prashad
Greenhorn

Joined: Mar 27, 2012
Posts: 7
i am using class without package
deepak prashad
Greenhorn

Joined: Mar 27, 2012
Posts: 7
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
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38902
    
  23
Seetharaman Venkatasamy wrote:
javac askme.java compiled successfully

On Windows®, the OS can pass the argument to javac in a case-insensitive fashion.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: interface