Results 1 to 4 of 4
  1. #1
    MarkWilson is offline Member
    Join Date
    Jun 2008
    Location
    us
    Posts
    47
    Rep Power
    0

    Default command line args

    hi friends

    actually i want to run simple prg on Netbeans like

    class A
    {
    public static void main(String args[])
    {
    System.out.print(args[0])
    }
    }

    if i run this it will shows the Error for ArrayoutofBondException()

    so plz help me in that or how i can run this ?
    Last edited by MarkWilson; 08-03-2008 at 09:08 AM.

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Right click on the Project. Go to the properties. You can have project properties window. Click on the run menu. There you can find a text field to add Arguments. Add what you want there. Compile and run the file.

  3. #3
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,518
    Rep Power
    25

    Default

    Your program needs to test if there are any args(args.length > 0) passed to it before using the first arg: args[0]

  4. #4
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

Similar Threads

  1. Command line argument
    By denisatandi in forum New To Java
    Replies: 8
    Last Post: 10-16-2012, 11:37 PM
  2. [SOLVED] Compile from the command line
    By GilaMonster in forum New To Java
    Replies: 8
    Last Post: 06-13-2008, 07:12 AM
  3. Java command line
    By agouzoul in forum New To Java
    Replies: 2
    Last Post: 04-02-2008, 12:12 PM
  4. Exporting from the command line
    By o1121 in forum Eclipse
    Replies: 1
    Last Post: 08-09-2007, 07:29 PM
  5. Unable to execute command line command in java
    By LordSM in forum New To Java
    Replies: 1
    Last Post: 08-08-2007, 12:23 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
  •