Java classpath problem

Jan 12, 2009 at 4:25pm

Java classpath problem

I’m having an issue with mxj and the corresponding object’s code path. I’m running Max 5.05 on Win XP. The classpath is the default.

I keep all my java class code (source and compiled) in C:/Program Files/Cycling ’74/Max 5.0/Cycling ’74/java/classes. However, I keep my Max patcher files on my D: drive.

If I have a patch with a java object, once the patch is saved on the D: drive, I can’t open the source code. The Max window says it’s looking for D:/program files… (etc) for some reason instead of C:/program files… (etc).

The weird thing is that the patch still runs fine. I can save and open it, and it loads the object without a problem. But Max keeps looking to the D: drive for the class source file, so I can’t edit it. This makes developing very difficult.

If I save the Max patcher file on the C: drive then I am able to open and edit the java object as expected.

I guess the Max patcher file has to be on the same drive as the java class? I’ve tried a whole bunch of things to get around it but nothing works. Anybody have any suggestions?

thanks – steve

PS – also, double-clicking on the mxj object no longer opens the java source code, even when both files are on the C drive. It literally stopped working one day. I always have to use a “viewsource” message. I’ve even re-installed MAX but it didn’t fix it.

#41651
Jan 15, 2009 at 6:53am

Hi,
I don’t know how to fix your problem. It sounds like a bug…

If you are doing any serious Java object development, I would recommend using an external editor that has better features for writing Java code. Then you don’t have to worry about this issue (it only affects viewing source/editing, right?)

This could get you started with Eclipse (free): http://compusition.com/web/articles/maxmsp-eclipse

Other people like Netbeans (also free). Or you might like a more straightforward text editor like TextMate (commercial but reasonably priced).

I prefer TextMate in general but Eclipse has some better features for working on larger Java projects, so I use them both.

#148446
Jan 15, 2009 at 6:55am

Whoops, you are on Windows and TextMate is Mac only, but there are tons of free/cheap editors on Windows. Eclipse & Netbeans work on windows too.

#148447
Jan 15, 2009 at 2:51pm

Actually I have tried to use external editors, but the problem persists. It’s very strange: I open the patch file from the D: drive and the mxj class works (like usual). I edit the Java file on the C: drive and recompile. Then I force the mxj class to reload. It reloads fine but doesn’t have any of the changes from the recompile! How can it reload, then, when the old class has been overwritten? I must be a cache thing, because I have to close Max completely and open it again for the patch to load the new mxj class. This isn’t a suitable workaround (closing and reopening Max completely for every change) for development.

I’ve tried setting explicit class paths in the java configuration file as well as in the Max file reference. I’ve even reinstalled everything. No matter what I do, it seems that the Java class must be on the same hard drive as the Max patcher file in a development scenario. It’s a pretty frustrating bug.

#148448
Jan 15, 2009 at 6:16pm

Quote: banfangled wrote on Thu, 15 January 2009 06:51
—————————————————-
> Actually I have tried to use external editors, but the problem persists. It’s very strange: I open the patch file from the D: drive and the mxj class works (like usual). I edit the Java file on the C: drive and recompile. Then I force the mxj class to reload. It reloads fine but doesn’t have any of the changes from the recompile! How can it reload, then, when the old class has been overwritten?

Hmm, I guess it must be because you are on different hard drives. Normally I delete the mxj object and undo and it has the latest code. There is one gotcha though: say you have your main MaxObject class, and it uses code from other classes. Any time you change the other class, if you want Max to pick up those changes you have to change the actual MaxObject code too (I just add a space and save the file). Only when the MaxObject class changes will the delete/undo pick up the latest code.

But that’s probably not your problem, I wouldn’t be surprised if there is some weird issue using the D: drive. You could send a bug report to support

#148449
Feb 23, 2009 at 12:59pm

Bump for justice, I have this bug too, what’s worse it’s intermittent. Some times when I send a ‘viewsource’ to mxj I get my source, can fiddle, save, recompile and force a reload by deleting and retyping a letter in the mxj’s object box and other times I just get the same problem as you forcing me to shutdown and restart max before the newly compiled class loads. Then if I restart the whole computer it sometimes goes away for a bit.

This makes me very sad Sad

#148450

You must be logged in to reply to this topic.