"Written in" != "Can communicate with"
I know how, for example, to communicate between two java programs if I needed to. If I had two programs on two different machines, I could use sockets and streams. But what if those programs were written in different languages? You could conceivably use files, but are there any other ways of communicating?
You'd use the same techniques whether the two programs are written in the same language or different languages.
The language that a system can communicate with has nothing to do with the language it is written in. Your Chrome browser, for example, is written in c++, but the language that it "talks" is HTTP. The web server, as long as it conforms to the HTTP specification, can be written in any language, and it'll still work. And there are many languages have libraries that allow them to communicate via HTTP.
Same goes for other communication protocols, including EDI, ODBC, SMTP, you name it. If you were to take Wireshare and look at what is being sent over the network, you aren't going to see any Java or C++ code. The language the program is written in is totally irrelevant.
In fact, if you did have a protocol that passed c++ or Java over the wire, there would be two huge issues:
(1) It would be incredibly difficult to deal with, because most programs, at runtime, don't even understand the language they're written in; the compiler can read that language, but it emits either machine language or some sort of intermediate language (bytecode for Java or IL for C#, for instance). It is often the case that the run time does not understand source code at all.
(2) There would be a huge security exposure, since anything sent over such a protocol would be wide open to an injection attack.