java.io.IOException: Cannot run program "sh": java.io.IOException: error=2, No such file or directory at java.lang.ProcessBuilder.start(ProcessBuilder.java:460) at java.lang.Runtime.exec(Runtime.java:593) at java.lang.Runtime.exec(Runtime.java:466) at jline.UnixTerminal.exec(UnixTerminal.java:292) at jline.UnixTerminal.exec(UnixTerminal.java:277) at jline.UnixTerminal.stty(UnixTerminal.java:268) at jline.UnixTerminal.initializeTerminal(UnixTerminal.java:71) at jline.Terminal.setupTerminal(Terminal.java:75) at jline.Terminal.getTerminal(Terminal.java:26) at jline.ConsoleReader.<init>(ConsoleReader.java:174) at jline.ConsoleReader.<init>(ConsoleReader.java:169) at groovy.ui.InteractiveShell.<init>(InteractiveShell.java:221) at groovy.ui.InteractiveShell.<init>(InteractiveShell.java:185) at groovy.ui.InteractiveShell.<init>(InteractiveShell.java:174) at groovy.ui.InteractiveShell.main(InteractiveShell.java:91) Caused by: java.io.IOException: java.io.IOException: error=2, No such file or directory at java.lang.UNIXProcess.<init>(UNIXProcess.java:148) at java.lang.ProcessImpl.start(ProcessImpl.java:65) at java.lang.ProcessBuilder.start(ProcessBuilder.java:453) ... 14 more Groovy Shell (1.8.5, JVM: 1.6.0_31)
reason seems to be that /bin/sh is needed but PATH is set to the JVM directories only: gjl --package groovy --get-args […] export PATH="/opt/sun-jdk-1.6.0.31/bin:/opt/sun-jdk-1.6.0.31/jre/bin";
I can confirm the existence of this bug also for the 32-bit x86 platform. Is there any workaround/fix for this problem? I do not know java-config well enough... Mr. Waldvogel has identified the problem correctly -- running groovysh under strace shows that groovysh tries to exec the shell "sh" and fails: [pid 25169] execve("/opt/sun-jdk-1.6.0.31/bin/sh", ["sh", "-c", "stty -g < /dev/tty"], [/* 73 vars */]) = -1 ENOENT (No such file or directory) [pid 25169] execve("/opt/sun-jdk-1.6.0.31/jre/bin/sh", ["sh", "-c", "stty -g < /dev/tty"], [/* 73 vars */]) = -1 ENOENT (No such file or directory)
What version of java-config and groovy are you running? When I run gjl --package groovy --get-args I have the following output export PATH="/opt/icedtea-bin-7.2.2.1/bin:/opt/icedtea-bin-7.2.2.1/jre/bin:${PATH}"; PATH=${PATH%:}; Thanks.
groovy: 1.7.5 java-config: 2.1.11-r3 JVM: dev-java/sun-jdk 1.7.0.5-r1 gjl --package groovy --get-args […] export PATH="/opt/oracle-jdk-bin-1.7.0.5/bin:/opt/oracle-jdk-bin-1.7.0.5/jre/bin"; […]
I confirm the issue existence. $gjl --package groovy --get-args | grep PATH export ROOTPATH="/opt/sun-jdk-1.6.0.35/bin:/opt/sun-jdk-1.6.0.35/jre/bin"; export MANPATH="/opt/sun-jdk-1.6.0.35/man"; export PATH="/opt/sun-jdk-1.6.0.35/bin:/opt/sun-jdk-1.6.0.35/jre/bin"; export LDPATH="/opt/sun-jdk-1.6.0.35/jre/lib/amd64/:/opt/sun-jdk-1.6.0.35/jre/lib/amd64/native_threads/:/opt/sun-jdk-1.6.0.35/jre/lib/amd64/xawt/:/opt/sun-jdk-1.6.0.35/jre/lib/amd64/server/"; $java-config --version Java Configuration Utility Version 2.1.11
I have modified the file /usr/share/java-config-2/vm/sun-jdk-1.6 by changing PATH variable to: PATH="${JAVA_HOME}/bin:${JAVA_HOME}/jre/bin:/bin:/usr/bin" And now the annoying error message has vanished. Is it correct? Is it bug in sun-jdk-1.6 ?
Updating to dev-java/java-config-2.1.12 solves the issue. No manual changes in jvm's env are required.
(In reply to comment #7) > Updating to dev-java/java-config-2.1.12 solves the issue. No manual changes > in jvm's env are required. This does indeed seem to fix the issue on my system also
With java-config-2.1.12 stable this should be fixed. Thanks for the report and testing.
confirmed. thanks.