Combining the strengths of the Java (TM) programming language and The Mathworks' Matlab (TM) offers interesting new possibilities for application development. Java and its J2EE (TM) development environment are well established today as to provide solutions for dynamic Web services, large-scale distributed systems, and other network-centric applications. Matlab is a technical computing environment with a high-level programming language. Due to its ease of use and its strong graphics capabilities, it has become popular across many engineering disciplines.
Matlab includes an interface to Java. It allows Matlab to access Java (you may call Java classes from Matlab), but not vice versa. This introductory article presents two alternative solutions on how to interface Matlab with Java, one based on the Java Runtime class, the other one based on the Java Native Interface and Matlab's C Engine library. With the proposed strategies, a Java-based system can easily start a new Matlab session and communicate with it, thus employ Matlab as the computational engine. Advantages and disadvantages of each approach are presented.
The complete preprint describing both approaches is available for download at
Important note: Approach 1, using the Java Runtime class and input/output streams does not work on Windows.