Java in max (the 'easy' way)

Jul 11, 2010 at 4:12am

Java in max (the 'easy' way)

Hi,

I tried to go through the java tutorials, but I have a problem – I can’t get the java code to compile.

I am new to java, but have been working with processing before, so java seems familiar to me.

If I just could open up some java code in the max patch itself by double clicking a max/java object, then I am sure that I can go on from there, so all I am asking for is if anyone has some example code for max with a java object in the max patch with one inlet and one outlet defined in the java code.

In this way I can click on the max/java object, open up the code and add onto the code from within max.

Thanks ahead,

ana

#51312
Jul 11, 2010 at 4:21am

Try compiling it with [mxj quickie yourobjname] which should set everything up for you in a max editor window. You can compile from there and should have no problems.

lh

#183995
Jul 11, 2010 at 9:35am

hello anamaria:
Ok, different issues:
1-There are different ways to compile java externals: you can use the quickie, the java compiler in the terminal or an IDE(Eclipse, NetBeans or XCode). If you decide to go with the terminal your will need to type something similar to this:
javac -classpath /Applications/Max5/Cycling ’74/java/lib/max.jar:/Applications/Max5/Cycling ’74/java/lib/jitter.jar AnaMaria.java

2-Yes, processing is Java but it has subtle differences with the java- jitter implementation. If you open the Processing sources you will discover that it is using something called PApplet:

http://www.learningprocessing.com/tutorials/processing-in-eclipse/

Jitter makes use of matrices, take a look into the jitter tutorials. That means that you will need to translate the methods from processing into something that can be used as matrix information. In the example attached i am using a simple random generator which fills with values the coordinates(i,j) of the matrix jjm .

3-I strongly suggest you to study the API, there you will find all kind of useful information.

good luck!
Emmanuel

Attachments:
  1. template.zip
#183996
Jan 9, 2011 at 5:59pm

Thanks! That template goes a long way toward explaining the confusing bits of “where’s my code inside of mxj?”

#183997
Jan 9, 2011 at 9:15pm

Hehehe, hope it is useful!

#183998

You must be logged in to reply to this topic.