从Java运行pmcmd [英] Running pmcmd from java
本文介绍了从Java运行pmcmd的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试运行pmcmd并从Java传递参数.这是我的代码:
I am trying to run pmcmd and pass arguments from java. This is my code :
String cmd="C:\\Informatica\\9.6.1\\clients\\PowerCenterClient\\CommandLineUtilities\\PC\\server\\bin\\pmcmd.exe";
final Process cmdProcess;
cmdProcess = Runtime.getRuntime().exec(new String[]{cmd,"connect -sv IS_NAME -d DOMAIN_NAME -u USER -p PWD"});
cmdProcess.getOutputStream().close();
问题是我无法获得所需的输出.我收到以下错误:
The problem is I am not able to get the desired output. I get the following error:
ERROR: Unknown command [connect]
当我在命令行上尝试相同的命令时,它会起作用.
When I try the same command on the command line, it works.
pmcmd>connect -sv IS_NAME -d DOMAIN_NAME -u USER -p PWD
输出:
Connected to Integration Service:[IS_NAME].
有人可以告诉我我在做什么错吗?
Can anyone tell what mistake I am doing?
推荐答案
我必须在pmcmd进程中发出命令.所以我修改了代码,它起作用了:
I had to issue a command within the pmcmd process. So I modified my code and it works :
String cmd="C:\\Informatica\\9.6.1\\clients\\PowerCenterClient\\CommandLineUtilities\\PC\\server\\bin\\pmcmd.exe";
final Process cmdProcess;
cmdProcess = Runtime.getRuntime().exec(new String[]{cmd,""});
OutputStream out = cmdProcess.getOutputStream();
out.write("connect -sv IS_NAME -d DOMAIN_NAME -u USER -p PWD".getBytes());
out.close;
这篇关于从Java运行pmcmd的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文