Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / February 2005

Tip: Looking for answers? Try searching our database.

command line arguments

Thread view: 
yawnmoth - 10 Feb 2005 01:08 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
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?


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.