java version question

Jan 8, 2008 at 7:21pm

java version question

Have java-dev folks –

I’ve finished up a fun new mxj thing (maxlispj!), and a number of
people were kind enough to test it out. I ran into one problem + a
solution: I hadn’t realized that mxj depended on the host machine’s
jvm. I created my first jar using java v. 1.5, but anyone still
running 1.4.x would get a major.minor version number error when trying
to load my classes. I can compile my classes and make the jar using
1.4, so all is ok.

My question, though — should I make both a 1.4 and a 1.5 version
available, or just distribute the 1.4-compiled version? Obviously I’m
not using any 1.5-specific features, but are there any other
advantages to using a 1.5-compiled version?

brad

http://music.columbia.edu/~brad

#35271
Jan 8, 2008 at 7:40pm

On 8 janv. 08, at 20:21, garton@columbia.edu wrote:

> I’ve finished up a fun new mxj thing (maxlispj!), and a number of
> people were kind enough to test it out. I ran into one problem + a
> solution: I hadn’t realized that mxj depended on the host machine’s
> jvm. I created my first jar using java v. 1.5, but anyone still
> running 1.4.x would get a major.minor version number error when
> trying to load my classes. I can compile my classes and make the
> jar using 1.4, so all is ok.

I’m not a java expert, but ejies java externals are compiled with java
1.4 and run fine with java 1.5.

ej

#120053
Jan 8, 2008 at 11:05pm

> My question, though — should I make both a 1.4 and a 1.5 version
> available, or just distribute the 1.4-compiled version? Obviously
> I’m not using any 1.5-specific features, but are there any other
> advantages to using a 1.5-compiled version?

Java 1.5 is pretty universal these days (now that OS X has caught up)
so everything I’m doing targets 1.5, and uses 1.5 libraries and
language features.

As Emmanuel says, the JVM is backwards compatible regarding bytecode
format, so 1.4 code will run on a 1.5 JVM, and if you’re happy
sticking with 1.4 there shouldn’t be any problems. (If you decide to
generate 1.4 code with a 1.5 JDK to target 1.4 systems, you might
want to make sure you aren’t relying on 1.5-specific bits of the API.)

– N.

nick rothwell — composition, systems, performance — http://
http://www.cassiel.com

#120054
Jan 8, 2008 at 11:16pm

On Jan 8, 2008, at 6:05 PM, Nick Rothwell wrote:

> As Emmanuel says, the JVM is backwards compatible regarding
> bytecode format, so 1.4 code will run on a 1.5 JVM, and if you’re
> happy sticking with 1.4 there shouldn’t be any problems. (If you
> decide to generate 1.4 code with a 1.5 JDK to target 1.4 systems,
> you might want to make sure you aren’t relying on 1.5-specific bits
> of the API.)

So there’s no performance hit or anything? I figured it was probably
fine (and I probably will go with 1.4 for now), but wanted to see if
there were any reasons not to do it.

thanks!

brad

http://music.columbia.edu/~brad

#120055
Mar 23, 2009 at 11:27am

may I append this thread ….

I updated to Leopard and newest Java (1.6), got XCode and eclipse … I recompiled some older java externals (in XCode) and tried a new one in eclipse (eclipse set to Java 1.6) and both external when loaded into mxj say

java.lang.UnsupportedClassVersionError: Bad version number in .class file

So, which version of Java is supported by Max5?

Also, I updated the xcode example files that came with Max5 (which where looking for the max.jar in the wrong location) – I think that is correct … otherwise it would not compile at all I guess. Also think I got that correct for eclipse (same reason) …

Any hints what to change …

thanks and best

#120056
Mar 25, 2009 at 9:45am

Just if someone else comes across this …

changed the Java compiler used to 1.5 and it seems to work now … so for some reasons MaxJVM does not seem to support Java 1.6 …

best

#120057
Mar 25, 2009 at 6:47pm

Have you tried setting

max.java.jvm.version

in max.java.config.txt?

#120058
Mar 27, 2009 at 10:39am

hello,

no … thanks, I was looking for something like that …

so there is currently no such entry in there – so I would try:

max.jvm.version -1.6

or?

thanks for your help, greatly appreciated Smile

best

#120059
Mar 28, 2009 at 5:34pm

At one stage I was putting

max.java.jvm.version 1.5

to force 1.5 instead of 1.4 (when using OS X 10.4.x). It may well work to get 1.6.

#120060
Apr 2, 2009 at 4:44am

I’ve been trying to use Java 1.6 with Max but have been unsuccessful.

Recently I had made Java 1.6 the default for my OS X 10.5 system by following these instructions: http://www.crc.id.au/2007/06/07/installing-java-16-on-osx/
I have a Core 2 Duo Intel Mac (64-bit) and this works fine for command line java (but breaks Eclipse, see http://lookfirst.com/2008/06/eclipse-3x-and-java-16-on-osx.html)

This breaks Java in Max. When trying to create any mxj object, I get the following error in the Max window:
Unable to create JVM

I tried setting
max.java.jvm.version 1.6
in the config file as Nick suggestions but it gives the same error.

The JDK 1.6 provided by Apple is 64-bit only. I thought perhaps this is part of the problem. So I found these instructions for setting up a 32-bit java port:
http://www.netbeans.org/kb/61/java/javafx-jdk6-on-32-bit-mac.html#InstallingAndTestingTheSoyLatteJDK6

But that doesn’t work either. Same error. I can only get Java to work in Max with the 1.4 and earlier JDKs (which are all 32-bit).

Any idea how to get 1.6 working with Max on OS X? Will this require an update from Cycling ’74? I would really like to use some 1.6 features and take advantage of the improved performance.

#120061
Apr 2, 2009 at 9:34am
Adam Murray wrote on Thu, 02 April 2009 05:44
Recently I had made Java 1.6 the default for my OS X 10.5 system by following these instructions:

As noted in the comments there, Java 1.6 came down the wire as a Software Update at some stage – I have it here, although I didn’t install it explicitly. I can fire it up for Eclipse, but haven’t tried it for Max.

Quote:
But that doesn’t work either. Same error. I can only get Java to work in Max with the 1.4 and earlier JDKs (which are all 32-bit).

Don’t you mean 1.5 or earlier?

#120062
Apr 2, 2009 at 4:26pm
nick rothwell / cassiel wrote on Thu, 02 April 2009 02:34
Java 1.6 came down the wire as a Software Update at some stage – I have it here, although I didn’t install it explicitly.

Yup, that’s how I got it too. OS X will continue to use 1.5 until you manually configure your system to use 1.6. It’s possible I did something wrong. Whenever you or someone else gets a chance to try it with Max on OS X, I’d appreciate knowing if it works or if you run into the same problem.

Quote:
Don’t you mean 1.5 or earlier?

Yes.

#120063
Apr 2, 2009 at 7:36pm

Well, eclipse and 1.6 seem to work fine here on latest leopard on Intellimac … (not for Max externals but for general purpose Java).

I used the little app in Applications/utilities/java to set the system to 1.6 and of course I chose 1.6 in eclipse ….

for Max externals it seems better (although I did not try the tips from above with editing the file) to use an eclipse setup with 1.5 …

hope that helps

best

#120064
Apr 3, 2009 at 6:10pm
Adam Murray wrote on Thu, 02 April 2009 17:26
Whenever you or someone else gets a chance to try it with Max on OS X, I’d appreciate knowing if it works or if you run into the same problem.

“Unable to create JVM.”

I’d suspect the 32-vs-64-bit thing.

#120065
Apr 3, 2009 at 6:17pm

Following up: from Console:

03/04/2009 19:08:44 [0x0-0x209209].com.cycling74.MaxMSP[3029] _NSJVMLoadLibrary: NSAddLibrary failed for /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Libraries/libjvm.dylib
#120066

You must be logged in to reply to this topic.