This paper deals with modeling and simulation of distributed systems in Java programming language. Distributed systems consist of components which communicate and coordinate their actions by passing messages. Components of distributed systems which define some functionality are entities determined with static attributes. The paper presents general model for modeling in Java environment entities distributed systems communicate using message passing protocol. We described a way to present model components and their functional links in a form of an XML document. A model can be executed as an application and (or) an applet. Presented model can be used for modeling heterogeneous systems.