aspose file tools*
The moose likes Beginning Java and the fly likes Head First Java Chapter 11, example on page 346 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Head First Java Chapter 11, example on page 346" Watch "Head First Java Chapter 11, example on page 346" New topic
Author

Head First Java Chapter 11, example on page 346

Mark Nibert
Ranch Hand

Joined: Jul 01, 2009
Posts: 42
The issue I am having is where it says MidiEvent = null; I am not sure what is going on but it keeps failing the argument if statement. I also dont see where it is prompting for the user cmd line input. Here is the code:

Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19720
    
  20

Please Use Code Tags. You can edit your post to add them.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

It doesn't prompt for input, it gets the arguments from the command line.

it keeps failing the argument if statement.

I'm not sure what that means.
Mark Nibert
Ranch Hand

Joined: Jul 01, 2009
Posts: 42
When I run it just processes this line System.out.println("Don't forget the instrument and note args");
I am not sure how to get the information in to the program from the command line. I am still pretty new to this and I cant figure it out.
Nitish Bangera
Ranch Hand

Joined: Jul 15, 2009
Posts: 537

I hope you are using the cmd for this.

Now while you give java MiniMiniMusicCmdLine 1 2. any integer should be specified as it takes the input from the command line.

If you want to take the input in the program it self then i guess you can use scanner and console.


[ SCJP 6.0 - 90% ] , JSP, Servlets and Learning EJB.
Try out the programs using a TextEditor. Textpad - Java 6 api
Mark Nibert
Ranch Hand

Joined: Jul 01, 2009
Posts: 42
Is that where I am screwing up? I am using eclipse for coding it. I will read through the tutorial and run it from the command line tonight. I swear sometimes my brain doesnt function properly.
Nitish Bangera
Ranch Hand

Joined: Jul 15, 2009
Posts: 537

Well i for starters i don't prefer using an IDE. You better use notepad or Textpad(can compile and execute from inside also) and compile and execute using the command line only. Also if you are using eclipse, find out where can you pass in the parameters. Every IDE has that option where you can specify the command line parameters which needs to be passed.
Mark Nibert
Ranch Hand

Joined: Jul 01, 2009
Posts: 42
Are there any good websites w/ labs that I can work through to help enforce the theories and ideas. I have taken programming classes and I am working on an idea for a program to write that I can use as a demo and to hopefully learn some of the more advanced ideas. I wish I would have kept the ones from college.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39409
    
  28
Nitish Bangera wrote:Well i for starters i don't prefer using an IDE. You better use notepad or Textpad . . .
Agree. But NotePad is pretty bad for programming. Download NotePad2 or NotePad++ which despite the names are quite different from NotePad.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Head First Java Chapter 11, example on page 346