XML Feeds

.

[java-dev] dynamically loading java classes in a standalone

Brad Garton garton at columbia.edu
Thu Feb 21 19:56:05 MST 2008


Ok, I see I'm pretty confused about this.  But the behavior I'm  
seeing is also confusing, and I can't think of why.  It's my maxlispj  
object, and the BGabcl.jar file is 6.0 Mbytes.  Un-jarred and  
inflated, it's about 30 Mbytes of classes (which is the amount that  
gets allocated when it does the "slow load" thing).  Here's the  
behavior:

In a standalone, if I put the BGabcl.jar file in either of these  
directories:

	my.app/Contents/support/java/lib/
	my.app/Contents/support/

it loads quickly without the additional 30 Mbyte memory allocation.   
If I put it here:

	my.app/Contents/support/java/classes/

it takes a long time to load and allocates about 30 Mbytes of memory.


In the MaxMSP application, if I put it here:

	/Applications/MaxMSP 4.6/Cycling '74/java/classes/

it takes a long time to load and allocates about 30 Mbytes of  
memory.  But if I add this line to the max.java.config.txt file:

	max.dynamic.class.dir "/Applications/MaxMSP 4.6/Cycling '74/java/ 
classes/BGabcl.jar"

it loads quickly.  Hence the source of my confusion about the dynamic  
classpath.

One final weirdness, if I put the BGabcl.jar file here:

	/Applications/MaxMSP 4.6/Cycling '74/java/lib/

with or without an entry in the max.java.config.txt file, it loads  
quickly (and works ok!), but I get these errors in the Max window:

	error: java.util.zip.ZipException: No such file or directory
	error: at java.util.zip.ZipFile.open(Native Method)
	error: at java.util.zip.ZipFile.<init>(ZipFile.java:203)
	error: at java.util.zip.ZipFile.<init>(ZipFile.java:84)

followed by some Lisp loader errors, but the object gets instantiated  
ok!

I've been using the object a lot, and it seems to work well even in  
the slow-load case.  I really don't know what's going on with the  
loading differences, though.

I know you've got a lot going on right now, so don't delve into this  
too deeply unless something seems obvious to you from the above  
description.  If I put it in the right dirs, it works fine, and I'm  
happy.

brad



More information about the java-dev mailing list