# 2.0: ARGV\[0\] Returns Something Even When It Should Be Empty

**URL:** <https://www.ruby-forum.com/t/2-0-argv-0-returns-something-even-when-it-should-be-empty/164593>\
**Category:** JRuby\
**Created:** [April 2, 2009, 10:38pm UTC](https://www.ruby-forum.com/t/2-0-argv-0-returns-something-even-when-it-should-be-empty/164593 "2009-04-02T22:38:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tom\_E\_Purl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/51bf81/32.png) [@Tom\_E\_Purl](https://www.ruby-forum.com/u/Tom_E_Purl)\
**Post date:** [April 2, 2009, 10:38pm UTC](https://www.ruby-forum.com/t/2-0-argv-0-returns-something-even-when-it-should-be-empty/164593/1 "2009-04-02T22:38:23Z")

</div>

I have trouble imagining that I’m the first person to find this, but I  
couldn’t find anything about it on the mailing list. I have a script  
that  
checks command line arguments by inspecting the ARGV array. Here’s the  
code I use:

raise “usage: jruby -S lssub.rb server\_name” unless ARGV.length == 1

When I ran this with the 2.0 interpreter _without_ an arg, it didn’t  
raise  
an error. I therefore printed the value of ARGV[0], and got the  
following:

1.1.5/bin/jruby.bat.exe

Weird. Here’s what I get when I inspect my jruby version:

jruby 1.2.0 (ruby 1.8.6 patchlevel 287) (2009-03-16 rev 9419) [x86-java]

Also, I still have the 1.1.5 and 1.1.6 versions of Jruby installed, and  
they behave in the expected way (throwing the exception above).

Am I doing something wrong, or is this a bug? I’m using Windows XP,  
by-the-way.

Thanks!

Tom Purl

---

<div class="post-metadata">

**Author:** ![Tom\_E\_Purl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/51bf81/32.png) [@Tom\_E\_Purl](https://www.ruby-forum.com/u/Tom_E_Purl)\
**Post date:** [April 3, 2009, 4:11pm UTC](https://www.ruby-forum.com/t/2-0-argv-0-returns-something-even-when-it-should-be-empty/164593/2 "2009-04-03T16:11:42Z")

</div>

Tom E Purl wrote:

> by-the-way.  
> No, looks like you’ve found a bug in the argument parsing logic in our  
> .bat startup files. Could you file a bug, and if you know anything about  
> .bat scripts maybe you could help figure out what’s wrong?

- Charlie

* * *

To unsubscribe from this list, please visit:

```
http://xircles.codehaus.org/manage_email

```
