Sponsored Links

Results 1 to 2 of 2

Thread: Why it is not working "CmdLineArgsApp.class"

  1. #1
    Senior Member saneha's Avatar
    Join Date
    Apr 2011

    Lightbulb Why it is not working "CmdLineArgsApp.class"

    Sponsored Links1

    AOA Sir,

    Here is the message when run the "java CmdLineArgsApp"

    D:\java>java CmdLineArgsApp
    Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
    at CmdLineArgsApp.main(CmdLineArgsApp.java:7)

    What is wrong with it?

    Sponsored Links

  2. #2
    Administrator Vuhelper's Avatar
    Join Date
    Apr 2011
    When while running CmdLineArgsApp you do not provide any command line arguments you get this exception.

    Because in the code args[0] and args[1] are being used , if we do not provide any argument at command line, args[0] and args[1] do not have any value and exception is generated.

    You can place a check to avoid this exception, you can check for number of element (i.e. check the value of args.length ) in args array if they are greater then 0 then proceed futher.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 0
    Last Post: 08-15-2014, 06:19 PM
  2. Replies: 0
    Last Post: 01-14-2012, 05:46 PM
  3. Replies: 1
    Last Post: 04-24-2011, 06:51 PM
  4. Replies: 1
    Last Post: 04-24-2011, 05:49 PM
  5. what is difference b/w "cin" and "cout". plz explain.
    By sana.pari in forum C++ Programing
    Replies: 1
    Last Post: 04-24-2011, 02:10 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
-: Vuhelp Disclaimer :-
None of the files shown here are hosted or transmitted by this server. The links are provided solely by this site's users. The administrator's or staff of Vuhelp.net cannot be held responsible for what its users post, or any other actions of its users. You may not use this site to distribute or download any material when you do not have the legal rights to do so. It is your own responsibility to adhere to these terms. If you have any doubts about legality of content or you have any suspicions, feel free to contact us.
Online Education | JhelumSoft | Jobs