The easiest way is set up a simple client/server. One of the programs creates a ServerSocket, then the other connects via Socket. Then set up IO streams(what to use depends on the type of data) and you are set. You will have to decide whether to use TCP or UDP. Network programming is an intermediate topic that is deep, luckily Java abstracts alot of the details for you, but it is still good to know the underlying basics.
Check out the 2 classes in the API and there should be a basic socket tutorial at java.sun.com. [ April 24, 2006: Message edited by: Rusty Shackleford ]
"Computer science is no more about computers than astronomy is about telescopes" - Edsger Dijkstra
What do you mean by "connecting two programs"? I can think of several ways to understand this phrase, one of which is the client/server model described above. Perhaps you can describe how you want to connect the two programs?