aspose file tools*
The moose likes Beginning Java and the fly likes Head First Java - Chapter 11 - MiniMusicCmdLine Error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Head First Java - Chapter 11 - MiniMusicCmdLine Error" Watch "Head First Java - Chapter 11 - MiniMusicCmdLine Error" New topic
Author

Head First Java - Chapter 11 - MiniMusicCmdLine Error

Sudheer Kolanu
Greenhorn

Joined: Nov 04, 2010
Posts: 13
Hello,

I was trying to execute the program on Pg 346 from Head First Java, MiniMusicCmdLine but the below error message displayed. I have gone through the progream multiple times but could not located what is causing this error.


C:\Library\Headache\Pro\Player>javac MiniMusicCmdLine.java
MiniMusicCmdLine.java:45: class, interface, or enum expected
}→
^
1 error


Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Apart from the fact that there some unknown methods in your cord (e.g. ParseInt), it seems that there is a strange character at the end of your file. Maybe you copy/pasted the code and it left some strange characters ? Remove the last line, and retype "}".


[My Blog]
All roads lead to JavaRanch
Sudheer Kolanu
Greenhorn

Joined: Nov 04, 2010
Posts: 13
I have typed in everything. I just noticed that there was an extrac closing curly brace at the last which was not posted in this thread which I removed now but getting differnt error now.


C:\Library\Headache\Pro\Player>javac MiniMusicCmdLine.java
MiniMusicCmdLine.java:8: cannot find symbol
symbol : method ParseInt(java.lang.String)
location: class java.lang.Integer
int instrument = Integer.ParseInt(args[0]);
^
1 error
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Sudheer Kolanu wrote:I have typed in everything. I just noticed that there was an extrac closing curly brace at the last which was not posted in this thread

Thanks for that...

but getting differnt error now.

That's the error I was talking about. Check the name of your method (tip: Java is case-sensitive)
Sudheer Kolanu
Greenhorn

Joined: Nov 04, 2010
Posts: 13
Thank you, it worked.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36478
    
  16
Sudheer Kolanu wrote:I have typed in everything. . . .
You shouldn't type anything. You should copy-and-paste, then you are sure you are posting real code.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Head First Java - Chapter 11 - MiniMusicCmdLine Error
 
Similar Threads
Head First Java P346 - MiniMusic Apps - hanging and not returning to the command line
Head First Java Chapter 11, example on page 346
using MIDI classes: HF Java
Head First Java Ch 11 Example
Running Java Command LIne