mxj
Description
Execute Java classes as Max objects. The Java classes must be specially written for Max, but work identically within the JVM (Java Virtual Machine) on both Windows and Macintosh.
Examples

Discussion
The mxj object and its MSP equivalent mxj~ instantiate specially-written Java classes and act as a Max-level peer object, passing data that originates in Max to the Java object and vice versa. The form that the mxj / mxj~ object takes (the number of inlets, outlets and the messages it understands), is determined by the Java class that it instantiates.
Using the mxj object requires that the host computer have a current version of the Java Virtual Machine (JVM) installed.
Max includes a directory called "java-doc", which can be found in the Max application folder.
The following important subdirectories are in the java-doc directory:
contains the source code and class files of the example Java classes that are included with Max.
contains the help files that are associated with the example Java classes. Exploring these patches is a good, quick way to see how mxj has extended and will extend the Max universe.
contains a step-by-step tutorial that leads you through the process of creating your first Java class to the application of advanced mxj programming techniques. The tutorial is in HTML format.
contains html files that specify the mxj object's Application Programming Interface (API). These pages will serve as an invaluable resource when you are coding your own Java classes.
contains example projects for some of the Integrated Development Environments (IDEs) we think you may want to use to create Java classes.
contains the code libraries that the mxj object uses to bridge the worlds of Max and Java.
In addition, a file named max.java.config.txt. also is located in the java directory This file allows you to specify which directories should be in Java's classpath -- a concept roughly analogous to the Max search path.
Arguments
Java-class [symbol]
The mxj object must be given the name of a valid Java class as the first argument. The Java class file must exist somewhere within the classpath, and it must be a class that was designed for use with the mxj object (the class must subclass com.cycling74.max.MaxObject.).
The number of inlets that an instance of mxj creates and the messages that it will respond to are determined by declarations made in the peer Java class.
attributes [list]
The mxj object supports the definition of attributes within the Java code for a peer class. The attributes that are settable at the time of instantiation using the @ paradigm. For instance, if a particular class Foo defined an integer attribute called intBar, one could create an instance of the class with the attribute set to the value 74 by typing in an object box.
Attributes
Common Box Attributes
Messages
bang
int
Arguments
float
Arguments
list
Arguments
anything
Arguments
(mouse)
get
Arguments
viewsource
zap
Output
various
The number of outlets that an instance of mxj creates is determined by declarations made in the constructor of the peer Java class. The furthest outlet to the right may or may not be an info outlet whose sole responsibility is to report information about the attributes when queried.
See Also
Name | Description |
---|---|
Using Max with other applications | Using Max with other applications |
js | |
Tutorial 51: Jitter Java | Tutorial 51: Jitter Java |