views:

42

answers:

2

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 run it on another machine via network. Need advice on this, what is the best way of doing it?

Thanks.

A: 

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.

Marm0t
+1  A: 

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.

Stephen C