Transferring icons via java(RMI) over network


I'm creating small, for my own use, chat machine with Java (RMI). Till now it can only send text messages n' show the various status. To fill it with more fun I thought of makin' it capable of sendin' even some icons but don't have any idea how its possible. So, plz help me work it out.



I'd suggest asking over in the sun java forums.

I’d agree you should probably ask over in the forums at

However, it is possible, but what you’ll probably want to do is have a reference to the ImageIcon, but you need to verify that ImageIcon is Serializable.  If it is then it should be just having a reference to your ImageIcon in the Object you’re passing over the connection.  If it’s not then you’ll have to do something on the order of getting the image in a byte[] and passing that over in your Object.

For a game I would not recommend using RMI in most situations though.  Something that might provide a little more robust capabilities would be my JavaGameNetworking API (gotta push it when I can)  It uses UDP messages that you can pre-define, so you can pass an image or even multiple images in a single message if you so desire.