i've written a small program to output the number of arguments that
have been passed to it. for example, if the program was called from
the command line with "java Test a a a", it'd output 3. atleast that's
what i think it should be doing. here's the program:
public class Test
{
public static void main (String[] args)
{
System.out.println("args.length = "+args.length);
}
}
no matter the number of command line arguments i pass to it, i always
get 0 as the length of the args array. is there something special i
have to do when compiling it, or soemthing, to let command line
arguments be passed to java programs?
any help would be appreciated - thanks!
Karsten Baumgarten - 10 Feb 2005 01:33 GMT
> i've written a small program to output the number of arguments that
> have been passed to it. for example, if the program was called from
[quoted text clipped - 15 lines]
>
> any help would be appreciated - thanks!
The code is fine and works as expected here. Perhaps you forgot to
recompile it or something?

Signature
Regards,
Karsten
Frances Del Rio - 10 Feb 2005 02:19 GMT
>> i've written a small program to output the number of arguments that
>> have been passed to it. for example, if the program was called from
[quoted text clipped - 18 lines]
> The code is fine and works as expected here. Perhaps you forgot to
> recompile it or something?
same here................
sanjay manohar - 12 Feb 2005 22:22 GMT
What command line are you using, and what OS?