Whenever I run any jython program in Eclipse, I got the following error in the beginning of the output:
" Failed to get environment, environ will be empty: (0, 'Failed to execute command ([\'sh\', \'-c\', \'env\']): java.io.IOException: Cannot run program "sh": Crea teProcess error=2, The system cannot find the file specified')
First, my environment is:
Windows 2008
JDK 1.6.0u10
jython 2.2.1
I did some digging, and I realized that this message is produced in the function javaos.getenv(). Whenever I call the javaos.getenv() function, it throws the following error:
C:\jython2.2.1>java -jar jython.jar
import javaos
print javaos.getenv("user.name")
Failed to get environment, environ will be empty: (0, 'Failed to execute command ([\'sh\', \'-c\', \'env\']): java.io.IOException: Cannot run program "sh": Crea teProcess error=2, The system cannot find the file specified')
This is strange, because I'm currently using a Windows machine, not an Unix.
Try to uncomment and change the os setting in the 'registry' file
(it is in the same directory as your jython.jar / i hope)
# python.os determines operating-specific features, similar to and overriding the
# Java property "os.name".
# Some generic values are also supported: 'nt', 'ce' and 'posix'.
# Uncomment the following line for the most generic OS behavior available.
#python.os=None
python.os=nt
# try nt or dos