首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2EE开发 >

java远程调用exe?解决方案

2012-01-01 
java远程调用exe?如题,现在在做一个统一门户系统,目前只支持web端的管理,其中有一家公司系统是exe可执行文

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.



Good luck!



探讨
有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*/}

[解决办法]
本地调用网上有例子,远程调用好象困难,可以商量一下把他们的exe放到你的服务器上吗?
[解决办法]
学习了
[解决办法]
汗。。。不懂,进来学习一下
[解决办法]
学习
[解决办法]
不需要远程调用嘛,使用js就可以了。js执行客户exe文件。
[解决办法]
给远程写个java程序,java程序调用exe,运程调用java程序
[解决办法]
给远程写个java程序,java程序调用exe,本地调用远程java程序,即RMI技术
[解决办法]
我想楼主想写个JAVA客服端去下载自己服务器上的病毒.exe去执行吧, 你那需求做项目也没有什么可能遇到, 不过不知道你把JAVA客服端做好了怎么传播 这倒是你应该研究的为题
[解决办法]
不懂,帮顶下~~
[解决办法]
webservice技术 axis,我做过类似的这个

热点排行
Bad Request.