While testing the AntBuilder stuff, I found that ENV['RUBY_HOME'] is nil in jruby but works in cruby. (There is only one environment variable that works in jruby which is HOME because of a specific bit of code.)

I had a go at fixing this initially using System.getenv() which returned a hashmap of all the envonment variables. This was great until I realized it was a Java5 feature.

Having googled around a bit, I see that everyone has the same problem and that pre java5 you need to drop out to the OS with Runtime.getRuntime().exec("env"|"set") and parse the output.

So I am happy to give this Runtime.exec("env"|"set") technique a go, if one of you core jruby guys thinks its the right direction to go in. ___________Is_the_right_direction___________? If not, I'll just drop it.

If it is the right direction to go in, then I see a couple of basic ways to implement:

(a) from scratch, copy and or get inspiration from what look like many "public domain" Runtime.exec solutions such as http://www.rgagnon.com/javadetails/java-0150.html

(b) Put ant.jar on the jruby classpath and call org.apache....Execute getProcEnvironment() (which is a comprehensive Runtime..exec solution too).

(c) Get inspiration from org.apache...Execute. (Presumably can't be copied to jruby because of ASL2 license? Sigh...

Aside number 1:
I can see that there is potential conflict/confusion between the linux:env/windows:set namespace and the java System.getProperty() namespace. Maybe the two namespaces can simply be combined in the ruby ENV hash? Maybe a seperate jrurby specific global is required for the java System.getProperty() namespace: ENV_JAVA or ENV_JRUBY or something.

Aside number 2:
I wasn't intending to do anything about either of these comments in the code related to the ENV global :
// TODO: ENV Not really a RubyHash (but close)
// TODO: ENV Should not copy system props, but should reference them instead
This seems like a seperate issue.

And finally, sorry if this an annoying low priority distraction from the hard core stuff going on at the moment.

Cheers all
Tim







-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Jruby-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jruby-devel

Reply via email to