Error!! how can i pass arguments?

View: New views
2 Messages — Rating Filter:   Alert me  

Error!! how can i pass arguments?

by hyperaura :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

hello there, i've downloaded Netbeans IDE to write a program in java. the following is just to try out how to pass arguments in netbeans but something seems to go wrong in netbeans. working environment is windows and i've also installed jdk1.6.



public class ArgsExmpl {

public static void main(String [] args)

{

System.out.println(args[0]);

}

}



the error i'm getting is the following:



Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0

at ArgsExmpl.main(ArgsExmpl.java:12)

Java Result: 1





Re: Error!! how can i pass arguments?

by Carlos Proal-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

You need to define the arguments in:

Project -> Properties -> Run

Carlos


On 10/17/2009 1:26 PM, hyperaura wrote:

> hello there, i've downloaded Netbeans IDE to write a program in java. the following is just to try out how to pass arguments in netbeans but something seems to go wrong in netbeans. working environment is windows and i've also installed jdk1.6.
>
>
>
> public class ArgsExmpl {
>
> public static void main(String [] args)
>
> {
>
> System.out.println(args[0]);
>
> }
>
> }
>
>
>
> the error i'm getting is the following:
>
>
>
> Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
>
> at ArgsExmpl.main(ArgsExmpl.java:12)
>
> Java Result: 1
>
>
>
>
>
>