Help around the JAVA part of my JAVA w/jitter project ...
Hi there.
I asked a lot of questions those previous days and I thank you all for your answers.
My system design progresses on paper (and on patch)
I'll have one JAVA core which will be the brain.
That one would instantiate other classes. Each classes would be a jitter object with almost same function.
How can I load/import all my other classes into the core ??
I know it is a basic question but I'm more comfortable with C++ and #include so, I ask the question =)
I know we can create package etc.
Maybe it would be a nice way to follow.
Can I do that using the small JAVA ide in Max ?
Hi Julien,
I am not much if a C++ guy, but roughly equivalent ti #include is the import
statement (the one you also use to import the i.e the max classes : import com.cycling74.max.*)
It is also possible to dynamically load classes inside Java. here's a short tutorial.
http://tutorials.jenkov.com/java-reflection/dynamic-class-loading-reloading.html
Jan
I highly recommend that you download the free Eclipse IDE and get familiar with it. If you're doing serious Java development it is miles ahead of the Java IDE in Max.
Jan is right about the import statement, this is the mechanism to load external classes in Java. You will have to locate your .class files in the Max classpath, or generate a JAR file that encapsulates your classes and place this in the classpath.
On the Mac, classes go in /Applications/Max6/Cycling '74/java/classes and JAR files go in /Applications/Max6/Cycling '74/java/lib.
I'm using XCode for all my external dev (C++, Objective "ugly" C, etc)
Eclipse rocks too.
I love the self contained stuff of its structure.
About CLASSPATH, I feel like if I had to put everything in those folders.
I'd like to locate things in my own structures for backuping purpose but maybe it would mess the whole stuff
If you want to do dynamic loading of objects, you are better off choosing a language suited to the task. Class reloading in Java can be a world of hurt, especially in MaxMSP land where you have three independent class loaders (one of them customised to conditionally track Max's search path). Sharing/aliasing of statics in a dynamic world gets to be a major problem for projects of more than a trivial size.
I still think you should look at Python or Clojure. The only thing Java really has going for it in this context is nice IDEs.
Hi Nick,
I got it :)
in myUniverse (the name of my system), I'd load all at runtime.
no dynamic loading during the performance.
I'd compose my "maps" (name of my presets), testing them, tweaking them, then, saving them (as XML.. as we discussed)
Then, I'd load the map, everything would be placed & instantiated.
Then, I'd play.
myUniverse core design is evolving a lot.
I described concepts here: https://cycling74.com/forums/does-instantiating-a-lot-of-max-objects-from-js-or-java-makes-sense-here
Basically, I'm now more in the way to have a JAVA core for messaging objects/OSCing/save/load things + Abstractions.
Those abstractions would be designed & optimized, and created by the JAVA (or even a JS) in my subpatchers.
I guess it would be the only way to do in my case : using directly Max/Jitter Objects instead of encapsulating inside JS or JAVA.
The JAVAor JS part in charge of creating those abstractions in the patch would ONLY have that job. The abstractions would make their own job and I know they are making it VERY correctly.