Hi,
In my Unix machine set environment variable (JAVA_TOP). From using JSch, I want
see value of that environment value. But is not showing. Even I am not able to
change from one directory to another using "cd" Ex. cd /user/uix/top
Do you have any idea. How to run "echo $JAVA_TOP" command "cd" command.
Thanks in advance.
I have written code like this ::
++++++++++++++++++++++
JSch jsch = new JSch();
InputStream in = null;
try {
Session session = jsch.getSession(username, hostname,
22);
session.setUserInfo(new MyUserInfo(password));
session.connect();
Channel channel = session.openChannel("exec");
((ChannelExec) channel).setCommand("echo $JAVA_TOP");
channel.setInputStream(null);
in = channel.getInputStream();
channel.connect();
byte[] tmp = new byte[1024];
while (true) {
while (in.available() > 0) {
int i = in.read(tmp, 0, 1024);
if (i < 0) {
break;
}
output += new String(tmp, 0,
i);
}
+++++++++++++++++++++
Regards,
SrikS------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure
contains a definitive record of customers, application performance,
security threats, fraudulent activity, and more. Splunk takes this
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
JSch-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jsch-users