开发者

running jar as webservice?

开发者 https://www.devze.com 2023-01-22 00:24 出处:网络
Can a .jar be run as a webservice? Since jar file consume a lot of cpu on my development machine, I would like to call and 开发者_JS百科run it on another machine via network. Need advice on this, wha

Can a .jar be run as a webservice? Since jar file consume a lot of cpu on my development machine, I would like to call and 开发者_JS百科run it on another machine via network. Need advice on this, what is the best way of doing it?

Thanks.


You can create a web service to run a Java command line application. It is relatively straightforward, but you will need to code a servlet wrapper that (typically):

  • maps HTTP requests and their arguments onto calls to your application, and
  • turns the output from the application into something that a web browser can handle.

And there are significant limits on what the service will be able. For instance, it won't be able to read or write files into the local file system of your development machine.


can you use JVM and use something like tomcat or some other java container?

lots of docs out there for that kind of stuff, most containers even have their own samples on how to create webapps.

0

精彩评论

暂无评论...
验证码 换一张
取 消