This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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.