Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

This Compiles, But Won't Run - Why?

 
Gary Farms
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7480
50
Android Eclipse IDE IntelliJ IDE Java Linux Mac Scala Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic