java远程调用exe?
如题,现在在做一个统一门户系统,目前只支持web端的管理,其中有一家公司系统是exe可执行文件的,放在windows2003服务器上,我怎么远程能调用的过来他的exe执行文件?请知道的告知解决方案等,先谢了。
------解决方案--------------------你的意思就是在WEB上调用执行服务器上的exe程序呗,这个简单,不过运行之后的事想过吗?
------解决方案--------------------
有permission吗?chmod 777
如果它是excutable的应该可以本地调用。。
try
{
Runtime rt = Rintime.getRuntime() ;
Process p = rt.exec("Program.exe") ;
InputStream in = p.getInputStream() ;
OutputStream out = p.getOutputStream ();
InputSream err = p,getErrorStram() ;
//do whatever you want
//some more code
p.destroy() ;
}catch(Exception exc){/*handle exception*/}
------解决方案--------------------建议lz的公司系统的exe可执行文件采用系统集成技术(如Web Service)以进程远程调用和访问
------解决方案--------------------帮顶...
------解决方案--------------------没明白,js调用呗
------解决方案--------------------JNative
------解决方案--------------------不懂,关注下
------解决方案--------------------java RMI试试?
------解决方案--------------------
对不住,我说错了,我顺着php了。。
正常的是:
Runtime.exec() runs programs locally, just as if you'd typed the command into a command shell. On a Linux box, it's as if you'd typed the command into a local bash shell; on a Windows box, it's as if you'd typed the command into a DOS command shell. In other words, the command is interpreted locally.
Here are some pitfalls people encounter when trying to run a command remotely:
*
Trying to include a remote hostname in the path to the executable. For example, trying this on a Windows box:
Runtime.exec("\\\\remotehost\\programname")
It doesn't work. That line is interpreted locally: if \\remotehost\programname resolves to a valid program on a share, that program will be read from the share and run locally.
*
Believing a command will work in Runtime.exec() because it works in a telnet session. But a telnet session is not a local command shell, it's a window to a shell running somewhere else.
So what does work?
To run a command remotely, you need a server on a remote machine that will accept a request for some service, and then make a request from the local program. Among the ways to do this are:
*
Define a CGI script on a remote Web server that runs the desired program. When the local program makes an HTTP connection to the appropriate URL, the program is run.
*
Run an RMI server on a remote machine and request services through an RMI call from the local machine.
*
Run a remote execution server (shell protocol) on the remote machine and use the corresponding client on the local machine. For example:
System.exec("rsh remotemachine programname")
*
Run a secure shell server on the remote machine and use the corresponding client on the local machine. For example:
System.exec("ssh remotemachine programname")
* Make up your own remote execution protocol and write server and client code.
Any of these approaches requires setting up security so access is limited to authorized users and password prompts don't show up at inconvenient times. There are many options here; the the key issue is that some server must run on the remote machine and the local machine must know how to request the needed service.