1

I'm trying to execute command which java remotely via ssh (JSch java).

I have a remote host that when I execute the command which java directly in the shell the output is like "/ltm/rt/oracle/java/jdk1.8/bin/java" that is correct, but when I try to execute the same command remotely via JSch java the output from the server is empty and I have the following error: which: no java in (/usr/local/bin:/usr/bin)

The user I've used for the authentication over ssh is the same that I use to access to the machine directly.

I'm asking for some ideas to bypass this issue. Thanks.

2
  • Can you post the relevant code? Commented Oct 15, 2020 at 10:49
  • Hi @f1sh, the code is simple, I want only to execute "which java" remotely, but the ouput is empty: WHICH_JAVA=which java echo $WHICH_JAVA Commented Oct 15, 2020 at 11:08

1 Answer 1

0

Enabling the pseudo-terminal mode the command is executed correctly.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.