getting started with Max Java

Feb 15, 2012 at 4:51pm

getting started with Max Java

Hello,

I’ve discovered the classes folder in c74 > java and wonder I can find some patches with these?

Thank you

#61797
Feb 15, 2012 at 4:59pm

Hi Kyred,

Those are located in c74 > java > help

Good luck,
FRid

#223104
Feb 15, 2012 at 5:22pm

Thanks.
However I get no success trying to compile a very simple script with quickie.
Instead of opening my file.java quickie opens a default script.
Both the .java and the .maxpat are in the classes folder (attached).
Please help getting started!

#223105
Feb 15, 2012 at 5:39pm

OK. Quickie just does like “.java” in the filename.
But now I get

Compiling /Applications/Max6/Cycling ’74/java/classes/javasimplegridshape.java………

/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/javac -classpath /Applications/Max6/Cycling ’74/java/lib/ej.jar:/Applications/Max6/Cycling ’74/java/lib/jitter.jar:/Applications/Max6/Cycling ’74/java/lib/jode-1.1.2-pre-embedded.jar:/Applications/Max6/Cycling ’74/java/lib/max.jar:/Applications/Max6/Cycling ’74/java/classes/ /Applications/Max6/Cycling ’74/java/classes/javasimplegridshape.java

/Applications/Max6/Cycling ’74/java/classes/javasimplegridshape.java[ 9 ] expected
mycircle = new JitterObject(“jit.gl.gridshape”,new Atom[]{Atom.newAtom(“cosm”)});
^
/Applications/Max6/Cycling ’74/java/classes/javasimplegridshape.java[ 11 ]
expected
mycircle.setAttr(“lighting_enable”,1);
^
/Applications/Max6/Cycling ’74/java/classes/javasimplegridshape.java[ 11 ] illegal start of type
mycircle.setAttr(“lighting_enable”,1);
^
/Applications/Max6/Cycling ’74/java/classes/javasimplegridshape.java[ 11 ] illegal start of type
mycircle.setAttr(“lighting_enable”,1);
^
/Applications/Max6/Cycling ’74/java/classes/javasimplegridshape.java[ 12 ]
expected
mycircle.setAttr(“smooth_shading”,1);
^
/Applications/Max6/Cycling ’74/java/classes/javasimplegridshape.java[ 12 ] illegal start of type
mycircle.setAttr(“smooth_shading”,1);
^
/Applications/Max6/Cycling ’74/java/classes/javasimplegridshape.java[ 12 ] illegal start of type
mycircle.setAttr(“smooth_shading”,1);
^
7 errors
[ 15 févr. 2012 18:37:55 ]
compilation of /Applications/Max6/Cycling ’74/java/classes/javasimplegridshape.java failed.

#223106
Feb 15, 2012 at 5:47pm

Okay, better like this and welcome to Java

import com.cycling74.max.*;
import com.cycling74.jitter.*;

public class javasimplegridshape extends MaxObject
{
JitterObject mycircle;

public javasimplegridshape(Atom[] args)
{

mycircle = new JitterObject(“jit.gl.gridshape”,new Atom[]{Atom.newAtom(“cosm”)});
// mycircle.setAttr(“shape”, “circle”);
mycircle.setAttr(“lighting_enable”,1);
mycircle.setAttr(“smooth_shading”,1);
}
}

#223107
Feb 15, 2012 at 6:04pm

Since i’m also a java-noob i will/(mostly can) not go into detail about what you did wrong. This is too avoid the possibility to confuse you more. I did however add some comments though and if you just copy this layout you should be allright.

HTH,
FRid

– Pasted Max Patch, click to expand. –
#223108
Feb 15, 2012 at 6:17pm

Many thanks for these adds and comment, it really helps and the connexions with java theory come in my head.
:-)

#223109
Feb 15, 2012 at 6:29pm

You’re welcome and i’d love to help you with the other post too but i haven’t yet played around with gl/jitter in java but i’m sure someone else will chime in.

#223110

You must be logged in to reply to this topic.