| Author |
Running a java file through the command line Vs IDE
|
Ravaa Bal
Ranch Hand
Joined: Apr 15, 2009
Posts: 31
|
|
Hi all,
I'm trying to run some example code provided by jsresources, http://www.jsresources.org/examples/SynthNote.html. It states that this code needs to be run by typing in a line in the command prompt in the form of:
java SynthNote <keynumber> <velocity> <duration>
(where the last three words are parameters)
The thing is, this doesn't work for me. I get a "could not find the main class" error. For the record, I set the directory of the command prompt to the folder where the java file is located using "cd <dir/dir/etc>" before typing in the above line.
With this in mind, I attempted to run this code in the Netbeans IDE but this returns:
SynthNote: usage:
java SynthNote [<channel>] <note_number> <velocity> <duration>
Java Result: 1
BUILD SUCCESSFUL (total time: 4 seconds)
So it was successful, but not only did I not hear a note sound as I was meant to but I also wasn't given a choice to input the parameters...
Would anyone happen to know what I could be doing incorrectly here? Any insight would be great.
Thank you.
|
 |
fred rosenberger
lowercase baba
Bartender
Joined: Oct 02, 2003
Posts: 9948
|
|
|
you don't need to be in the directory where the .java file is. You need to be in the directory where the .class file is.
|
Never ascribe to malice that which can be adequately explained by stupidity.
|
 |
Ravaa Bal
Ranch Hand
Joined: Apr 15, 2009
Posts: 31
|
|
Aha silly me, thank you.
Is it possible to run something like this on Netbeans and be able to enter parameters when testing? As opposed to using the command line...
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32689
|
|
|
The IDEs all have special windows where you enter the parameters. As a beginner you would usually be better using the command line.
|
 |
Ravaa Bal
Ranch Hand
Joined: Apr 15, 2009
Posts: 31
|
|
|
Fair enough, thanks for your input!
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32689
|
|
You're welcome
|
 |
 |
|
|
subject: Running a java file through the command line Vs IDE
|
|
|