Note that using both of those will require that your application run inside a Container, like tomcat. It's a lil bit more complicated than using plain java SE,
but will enable your application to the web.
There's also the option of using sockets, by in my point of view that would be very primitive AND it would give you a LOT more trouble.
abani patra wrote:I agree with Greenhorn you can use servlet for this but best solution is web service , you can use SOAP for this.
Yes, you can use SOAP, but why would you? Eduardo already mentioned RESTful web services, which should be the first tool of choice, unless and until it's clear that SOAP's capabilities are actually required. You certainly shouldn't claim it's the "best" solution, because that depends on the requirements about which we know just about nothing.
And yes, you can use servlets to implement simple RESTful web services, but I would advise to use a library like Jersey instead; it makes coding the service much simpler.
I hired a bunch of ninjas. The fridge is empty, but I can't find them to tell them the mission.
a bit of art, as a gift, the permaculture playing cards