Not able to invoke remote script in windows from linux using SSHEXEC
I have set up OpenSSH in my windows environment and wants to invoke a ANT script from a Linux environment. But i'm getting the following error:
$ ant -f invoke.xml
Buildfile: /home/inysi/jpegu/cdt/tmp/invoke.xml
run:
[sshexec] Connecting to ******
[sshexec] cmd : ant -f build.xml
[sshexec] uname: not found
[sshexec] basename: not found
[sshexec] dirname: not found
[sshexec] Error: JAVA_HOME is not defined correctly.
[sshexec] We cannot execute java
[sshexec] which: not found
BUILD SUCCESSFUL
Total time: 2 sec开发者_运维问答onds
But, i can invoke the remote ANT script in Linux environment using SSHEXEC from windows.
Can you please let me know, what could be the issue. JAVA_HOME is set in the windows environment variables. Where to set JAVA_HOME in the windows environment. Is there something similar to .bash_profile in windows. So that ANT process can pick it up.
Looks like you are connecting to the user account that does not have its environment setup correctly, because it cannot find any standard commands.
Providing us with a better sample of invoke.xml may help.
The invoke.xml file: sshexec host="windows.host" username="Test" password="test123" trust="true" command="ant -f build.xml
I have created the user "Test" in the windows host. I can invoke other commands e.g "java -version or java classname". But its only when i try to run an ANT script in the windows, it gives error "JAVA_HOME not defined".
It looks like the shell created at the SSH server side to invoke the command is not able to access the user environment variable "JAVA_HOME".
精彩评论