# Jruby and case insensitive environment variables on win32

**URL:** <https://www.ruby-forum.com/t/jruby-and-case-insensitive-environment-variables-on-win32/118683>\
**Category:** Ruby\
**Created:** [October 30, 2007, 2:15am UTC](https://www.ruby-forum.com/t/jruby-and-case-insensitive-environment-variables-on-win32/118683 "2007-10-30T02:15:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Martin\_DeMello](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f17d59/32.png) [@Martin\_DeMello](https://www.ruby-forum.com/u/Martin_DeMello)\
**Post date:** [October 30, 2007, 2:15am UTC](https://www.ruby-forum.com/t/jruby-and-case-insensitive-environment-variables-on-win32/118683/1 "2007-10-30T02:15:09Z")

</div>

When converting a Win32/Ruby application to JRuby, I ran into an  
interesting quirk - the Windows Ruby interpreter (1.8.6 from the  
one-click installer) let me “get away” with whatever mix of upper and  
lower case I liked when accessing environment variables (e.g.  
ENV[‘UserProfile’], ENV[‘userprofile’], ENV[“USERPROFILE”], etc),  
which is consistent with the way Windows itself does it. JRuby seems  
to follow the Unix model where UserProfile and USERPROFILE are two  
separate variables.

I raise this here rather than filing a bug with the JRuby team because  
I am unsure as to what the correct behaviour is - are JRuby  
environment variables a property of the JVM, and only incidentally a  
property of the underlying operating system that the JVM picked them  
up from, or should they accurately return the same results that MRI  
would have?

martin

---

<div class="post-metadata">

**Author:** ![Martin\_DeMello](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f17d59/32.png) [@Martin\_DeMello](https://www.ruby-forum.com/u/Martin_DeMello)\
**Post date:** [October 30, 2007, 4:54am UTC](https://www.ruby-forum.com/t/jruby-and-case-insensitive-environment-variables-on-win32/118683/2 "2007-10-30T04:54:06Z")

</div>

Martin DeMello wrote:

> I am unsure as to what the correct behaviour is - are JRuby  
> environment variables a property of the JVM, and only incidentally a  
> property of the underlying operating system that the JVM picked them  
> up from, or should they accurately return the same results that MRI  
> would have?

In JRuby, we pull in whatever the system provides as an environment, and  
we don’t do any magic to support case insensitivity. I’d like to know if  
1.8.6 is doing something “extra” to support this or if it’s just the way  
environment variables work on win32.

FYI, it has already been reported as a bug, so don’t worry about that.

[http://jira.codehaus.org/browse/JRUBY-1441](http://jira.codehaus.org/browse/JRUBY-1441)

Of course, if you’d like to try fixing it, we’d appreciate that too 🙂

- Charlie

---

<div class="post-metadata">

**Author:** ![Martin\_DeMello](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f17d59/32.png) [@Martin\_DeMello](https://www.ruby-forum.com/u/Martin_DeMello)\
**Post date:** [October 30, 2007, 6:47am UTC](https://www.ruby-forum.com/t/jruby-and-case-insensitive-environment-variables-on-win32/118683/3 "2007-10-30T06:47:25Z")

</div>

On Oct 29, 11:52 pm, Charles Oliver N. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> > I raise this here rather than filing a bug with the JRuby team because
> 
> FYI, it has already been reported as a bug, so don’t worry about that.
> 
> [http://jira.codehaus.org/browse/JRUBY-1441](http://jira.codehaus.org/browse/JRUBY-1441)
> 
> Of course, if you’d like to try fixing it, we’d appreciate that too 🙂
> 
> - Charlie- Hide quoted text -
> 
> - Show quoted text -

Windows’s environmental variables are case insensitive.

Hope’s that helps.
