# Jruby and case insensitive environment variables on win32

**URL:** <https://rubytalk.org/t/jruby-and-case-insensitive-environment-variables-on-win32/41772>\
**Category:** ruby-talk\
**Created:** [30 October 2007 01:14 UTC](https://rubytalk.org/t/jruby-and-case-insensitive-environment-variables-on-win32/41772 "2007-10-30T01:14:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Martin\_DeMello](https://avatars.discourse-cdn.com/v4/letter/m/f17d59/32.png) [@Martin\_DeMello](https://rubytalk.org/u/Martin_DeMello)\
**Post date:** [30 October 2007 01:14 UTC](https://rubytalk.org/t/jruby-and-case-insensitive-environment-variables-on-win32/41772/1 "2007-10-30T01:14:25Z")

</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:** ![Charles\_Oliver\_Nutte](https://avatars.discourse-cdn.com/v4/letter/c/71e660/32.png) [@Charles\_Oliver\_Nutte](https://rubytalk.org/u/Charles_Oliver_Nutte)\
**Post date:** [30 October 2007 03:52 UTC](https://rubytalk.org/t/jruby-and-case-insensitive-environment-variables-on-win32/41772/2 "2007-10-30T03:52:59Z")

</div>

Martin DeMello wrote:

> 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?

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:** ![Bernard\_Kenik](https://avatars.discourse-cdn.com/v4/letter/b/ed8c4c/32.png) [@Bernard\_Kenik](https://rubytalk.org/u/Bernard_Kenik)\
**Post date:** [30 October 2007 05:41 UTC](https://rubytalk.org/t/jruby-and-case-insensitive-environment-variables-on-win32/41772/3 "2007-10-30T05:41:45Z")

</div>

Windows's environmental variables are case insensitive.

Hope's that helps.

> **···**
>
> On Oct 29, 11:52 pm, Charles Oliver Nutter \<charles.nut...@sun.com\> wrote:
> 
> > Martin DeMello wrote:  
> > \> 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?
> > 
> > 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- Hide quoted text -
> > 
> > - Show quoted text -
