wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes This Compiles, But Won't Run - Why? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "This Compiles, But Won Watch "This Compiles, But Won New topic
Author

This Compiles, But Won't Run - Why?

Gary Farms
Ranch Hand

Joined: Jun 24, 2000
Posts: 57
This small program compiles OK, but when I try to run it I get:
"Exception in Thread "main" java.lang.NoSuchMethodErrror - "main"
The program is:

(edited by Cindy to format code)
[This message has been edited by Cindy Glass (edited June 19, 2001).]
le taylom
Ranch Hand

Joined: Dec 01, 2000
Posts: 44
I compiled this and it failed on compilation.
Remove the spaces between the two " | | " operators.
And break FAST_BREAK needs to be changed to break FAST_EXIT.
I then compiled and ran it. No problems!
Hope this helps.
T
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
Make sure that the name of the file that this is in is FastBreak.java (capitalization counts).
Make sure when you start the program with
>java FastBreak
that you spell it correctly including capitalization.


"JavaRanch, where the deer and the Certified play" - David O'Meara
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
Well I made the two corrections that le pointed out and it compiles and ran correctly. Lots of printout of number is: and char is: etc.
Therefore it is not the program. It is either your classpath, or the way that you are typing the class name when you invoke the program.
Try adding the c:\jdk1.3.0_02\bin directory to your classpath and move the dot reference to the front of the concatenation.
Then MAKE SURE that you are typing
>java FastBreak
exactly that way. Because for me, it is almost always my fingers causing the problem .
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4458
    
    6

Originally posted by Cindy Glass:
> Because for me, it is almost always my fingers causing the problem
Technical term for it is "PEBCAK"
And I don't think the spaces between--and I'm typing these without a space between them now--"| |" are Gary's fault: it's the ornery UBB that's doing it.

[This message has been edited by JUNILU LACAR (edited June 19, 2001).]


Junilu - [How to Ask Questions] [How to Answer Questions]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: This Compiles, But Won't Run - Why?