Forums > Java

getting started with Max Java

February 15, 2012 | 4:51 pm

Hello,

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

Thank you


February 15, 2012 | 4:59 pm

Hi Kyred,

Those are located in c74 > java > help

Good luck,
FRid


February 15, 2012 | 5:22 pm

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!


February 15, 2012 | 5:39 pm

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.


February 15, 2012 | 5:47 pm

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);
}
}


February 15, 2012 | 6:04 pm

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. –

February 15, 2012 | 6:17 pm

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


February 15, 2012 | 6:29 pm

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.


Viewing 8 posts - 1 through 8 (of 8 total)