• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Head First Java Chapter 11, example on page 346

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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:

 
Sheriff
Posts: 22781
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please Use Code Tags. You can edit your post to add them.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 537
Eclipse IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Mark Nibert
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 537
Eclipse IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Marshal
Posts: 79151
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic