I want a desktop(mac preferable) side Java program, which should be able to receive images from a servlet and show image. Basically, I have a mobile client application, which sends an image periodically to a servlet which runs on Eclipse with Tomcat server on Mac. So, This servlet receives an updated image from the client periodically. This is done already.
Now, I want to push this image from this servlet project to a desktop Java applet or some desktop based Java application, where it will be updating with the image it receives periodically. Both the server and desktop applet can run on the same machine for testing.
Could someone please advise,
This solution requires a slight change to your web server :
The best way forward is to create some kind of API call that your program can make that will request this image as an HTTP or HTTPS download. That way, you can save the image however you like on the server and then stream it back to the calling client.
Your desktop solution will be a standard Java SE application, NetBeans has a very neat feature that allows you to package an application as a native Mac app, which doesn't need Java installed, it has it's own JRE bundled. You can do the same in Eclipse, as it's a Java feature, I just haven't had luck getting it to work yet.
What you will then do, from your desktop, is simply have a thread that gets called, let's say, every 5 seconds to poll the API service for a new image. If there is one, it can download it using a standard HTTP call and then display the image.