How to share object between java applications?

前端 未结 6 1766
暖寄归人
暖寄归人 2020-12-11 03:53

I have 2 separate Java Applications running at a time. (Two separate javaw.exe) I need to share an object between them while they are running.

What is the simplest

6条回答
  •  青春惊慌失措
    2020-12-11 04:49

    You can use TCP

    1. Use a local software port, say localhost:999.
    2. Make one application as server (listening on this port) and other as client (will connect to server at localhost:999, but will use different port for it's own use).
    3. Client will serialize your object to stream.
    4. Server does de-serialize!

    Example: http://www.java-samples.com/showtutorial.php?tutorialid=1167

提交回复
热议问题