This paper describes JaRec, a portable record/replay system for Java. It correctly replays multi-threaded, data-race free Java applications, by recording the order of synchronization operations, and by executing them in the same order during replay. The record/replay infrastructure is developed in Java, and does not require a modification of the Java Virtual Machine if it provides the Java Virtual Machine Profiler Interface (JVMPI). If the JVM does not support JVMPI, which is used for intercepting the loaded classes, only a minor modification to the JVM is required in order to run the system. On systems with limited memory resources, JaRec can be executed in a distributed fashion. This makes it also suitable to aid debugging of multi-threaded applications on embedded systems.