java version question


    Jan 08 2008 | 7:21 pm
    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?

    • Jan 08 2008 | 7:40 pm
      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
    • Jan 08 2008 | 11:05 pm
      > 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:// www.cassiel.com
    • Jan 08 2008 | 11:16 pm
      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!
    • Mar 23 2009 | 11:27 am
      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
    • Mar 25 2009 | 9:45 am
      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
    • Mar 25 2009 | 6:47 pm
      Have you tried setting
      max.java.jvm.version
      in max.java.config.txt?
    • Mar 27 2009 | 10:39 am
      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
      best
    • Mar 28 2009 | 5:34 pm
      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.
    • Apr 02 2009 | 4:44 am
      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.
    • Apr 02 2009 | 9:34 am
      Adam Murray wrote on Thu, 02 April 2009 05:44Recently 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?
    • Apr 02 2009 | 4:26 pm
      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.
    • Apr 02 2009 | 7:36 pm
      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
    • Apr 03 2009 | 6:10 pm
      Adam Murray wrote on Thu, 02 April 2009 17:26Whenever 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.
    • Apr 03 2009 | 6:17 pm
      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