Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » How do I add command-line arguments when running as Java app?
How do I add command-line arguments when running as Java app? [message #267035] Thu, 11 December 2008 12:58 Go to next message
D. Alvarado is currently offline D. Alvarado
Messages: 91
Registered: July 2009
Member
Hi,

I'm using Eclipse 3.4 on WinXP. I want to run a file as a Java
application, so I right-click the file, select "Run As", and select "Java
Application". However at no point in the process am I asked to specify
command line arguments and so my Java app fails with
ArrayIndexOutOfBoundsExceptions b/c "args[0]" has no value.

How do I specify command-line arguments when running Java apps in Eclipse?

Thanks, - Dave
Re: How do I add command-line arguments when running as Java app? [message #267037 is a reply to message #267035] Thu, 11 December 2008 13:17 Go to previous messageGo to next message
Charlie Kelly is currently offline Charlie Kelly
Messages: 274
Registered: July 2009
Senior Member
Hi Dave,

Run->Run Configuration
select your launch configuration
go to "Arguments" tab
Supply your arguments as "VM arguments"

Charlie


D. Alvarado wrote:
> Hi,
>
> I'm using Eclipse 3.4 on WinXP. I want to run a file as a Java
> application, so I right-click the file, select "Run As", and select
> "Java Application". However at no point in the process am I asked to
> specify command line arguments and so my Java app fails with
> ArrayIndexOutOfBoundsExceptions b/c "args[0]" has no value.
>
> How do I specify command-line arguments when running Java apps in Eclipse?
>
> Thanks, - Dave
>
Re: How do I add command-line arguments when running as Java app? [message #267055 is a reply to message #267037] Fri, 12 December 2008 00:52 Go to previous message
Remy Suen is currently offline Remy Suen
Messages: 462
Registered: July 2009
Senior Member
Charlie Kelly wrote:
> Run->Run Configuration
> select your launch configuration
> go to "Arguments" tab
> Supply your arguments as "VM arguments"

Actually, I think Dave wants "Program arguments" since he's referring to
args[0] and not about VM arguments.

The FAQ link below has images to help guide you.
http://wiki.eclipse.org/Graphical_Eclipse_FAQs#How_do_I_add_ arguments_to_the_Java_program_I_am_running.3F

Remy

> D. Alvarado wrote:
>> Hi,
>>
>> I'm using Eclipse 3.4 on WinXP. I want to run a file as a Java
>> application, so I right-click the file, select "Run As", and select
>> "Java Application". However at no point in the process am I asked to
>> specify command line arguments and so my Java app fails with
>> ArrayIndexOutOfBoundsExceptions b/c "args[0]" has no value.
>>
>> How do I specify command-line arguments when running Java apps in
>> Eclipse?
>>
>> Thanks, - Dave
>>
Previous Topic:Toggle Line Breakpoint (epic)
Next Topic:open Perspective from Intro screen?
Goto Forum:
  


Current Time: Tue Jul 22 11:38:27 EDT 2014

Powered by FUDForum. Page generated in 0.01720 seconds