Rhinoに environment ってビルトインの変数が存在する事に気がついた。
Rhino(1.7R1)を使ってたら、environmentってビルトインのグローバル変数が存在する事に気がついた。
以下のワンライナーをRhino Shell上で実行したら、環境変数っぽいのが取得できた。
js> for(var key in environment) { print("[" + key + "]\n" + environment[key]); }
[java.runtime.name] Java(TM) SE Runtime Environment [sun.boot.library.path] C:\Program Files\Java\jre1.6.0_06\bin [java.vm.version] 10.0-b22 [java.vm.vendor] Sun Microsystems Inc. [java.vendor.url] http://java.sun.com/ [path.separator] ; [java.vm.name] Java HotSpot(TM) Client VM [file.encoding.pkg] sun.io [user.country] JP [sun.java.launcher] SUN_STANDARD [sun.os.patch.level] Service Pack 3 [java.vm.specification.name] Java Virtual Machine Specification [user.dir] c:\ [java.runtime.version] 1.6.0_06-b02 [java.awt.graphicsenv] sun.awt.Win32GraphicsEnvironment [java.endorsed.dirs] C:\Program Files\Java\jre1.6.0_06\lib\endorsed [os.arch] x86 [java.io.tmpdir] C:\DOCUME~1\terurou\LOCALS~1\Temp\ [line.separator] [java.vm.specification.vendor] Sun Microsystems Inc. [user.variant] [os.name] Windows XP [sun.jnu.encoding] MS932 [java.library.path] .;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\TortoiseSVN\bin; [java.specification.name] Java Platform API Specification [java.class.version] 50.0 [sun.management.compiler] HotSpot Client Compiler [os.version] 5.1 [user.home] C:\Documents and Settings\terurou [user.timezone] Asia/Tokyo [java.awt.printerjob] sun.awt.windows.WPrinterJob [file.encoding] MS932 [java.specification.version] 1.6 [user.name] terurou [java.class.path] D:\bin\Rhino\js.jar [java.vm.specification.version] 1.0 [sun.arch.data.model] 32 [java.home] C:\Program Files\Java\jre1.6.0_06 [java.specification.vendor] Sun Microsystems Inc. [user.language] ja [awt.toolkit] sun.awt.windows.WToolkit [java.vm.info] mixed mode, sharing [java.version] 1.6.0_06 [java.ext.dirs] C:\Program Files\Java\jre1.6.0_06\lib\ext;C:\WINDOWS\Sun\Java\lib\ext [sun.boot.class.path] C:\Program Files\Java\jre1.6.0_06\lib\resources.jar;C:\Program Files\Java\jre1.6.0_06\lib\rt.jar;C:\Program Files\Java\jre1.6.0_06\lib\sunrsasign.jar;C:\Program Files\Java\jre1.6.0_06\lib\jsse.jar;C:\Program Files\Java\jre1.6.0_06\lib\jce.jar;C:\Program Files\Java\jre1.6.0_06\lib\charsets.jar;C:\Program Files\Java\jre1.6.0_06\classes [java.vendor] Sun Microsystems Inc. [file.separator] \ [java.vendor.url.bug] http://java.sun.com/cgi-bin/bugreport.cgi [sun.cpu.endian] little [sun.io.unicode.encoding] UnicodeLittle [sun.desktop] windows [sun.cpu.isalist] pentium_pro+mmx pentium_pro pentium+mmx pentium i486 i386 i86