aspose file tools*
The moose likes Java in General and the fly likes NoSuchMethodError Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "NoSuchMethodError" Watch "NoSuchMethodError" New topic
Author

NoSuchMethodError

AaronMweu Munzaa
Greenhorn

Joined: Mar 04, 2004
Posts: 8
when I compile this code:::
***********************************
import java.util.Date;
class NewDate extends Date{
public void display(){
System.out.println(toString());
}
}
class DateShow{
public static void main(String args[]){
NewDate today = new NewDate();
today.display();
}
}
****************************
its compiles ok but when I try to run it I get this error:
Exception thread in "main" java.lang.NoSuchMethodError: main
AND
What do I do in order to be able to compile my code from ms-dos prompt without having to specify the directories and all that?
Please help
Jean-Francois Briere
Ranch Hand

Joined: Mar 03, 2004
Posts: 101
You must execute with DateShow and NOT NewDate:
> java DateShow
Blake Minghelli
Ranch Hand

Joined: Sep 13, 2002
Posts: 331
Your file must also be called DateShow.java.
What do I do in order to be able to compile my code from ms-dos prompt without having to specify the directories and all that?

If you include "." (current directory) in your CLASSPATH environment variable, then you can compile DateShow.java from within the directory it resides. So, if DateShow.java is in d:\projects, you can do this: I think that's what you were asking.


Blake Minghelli<br />SCWCD<br /> <br />"I'd put a quote here but I'm a non-conformist"
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: NoSuchMethodError
 
Similar Threads
Calendar problems
cannot find symbol class Dog
Unparseable date exception
Adding 'time' to a timestamp
add day to current date