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
posted
0
You must execute with DateShow and NOT NewDate: > java DateShow
Blake Minghelli
Ranch Hand
Joined: Sep 13, 2002
Posts: 331
posted
0
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"