Unsupported major.minor version 51.0 ERROR when running MXJ quickie
I have been trying to run java externals using mxj quickie, but it never worked and I was getting this error message in the Max window:
Unsupported major.minor version 51.0
I read online it is a common error when: "you compiled your classes under a specific JDK, but then try to run them under older version of JDK. So, you can’t run classes compiled with JDK 6.0 under JDK 5.0. The same with classes compiled under JDK 7.0 when you try to run them under JDK 6.0."
My question is, how do I know which version of java is MAX using to run Java? If I knew, I could search for an earlier version to compile, since I am using the last one (downloaded it today). My version of MAX is 5.0.7.
You haven’t specified whether you’re in OS X or Windows, but I can tell you how to do it inside Java itself:
You’d have to Google to match class file versions against Java versions/releases. I have some code for examining that somewhere.
Same problem here. Nothing I have tried works. I’m using the latest 1.7 release. I’ve tried editing max.java.config.txt to force java 1.7, ive changed the preferences in mxjpreferences.xml to point to the java jdk, etc etc…any help?
The classes in the max folder work, but compiling the simple "hello world" max tutorial program wont work
I have the same problem here. Running Max 6.1.8, Installed Eclipse and have Java JDK 1.7 update 67.
I updated the Max file mxjpreferences.xml to point to the current jdk:
<entry key="BUILD_ROOT" value="/Applications/Max 6.1/Cycling ’74/java/classes"/>
<entry key="COMMAND" value="/Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk/Contents/Home/bin/javac"/>
Double checked-through cut and paste that this is the correct path to javac. The error begins with:
java.lang.UnsupportedClassVersionError: gol : Unsupported major.minor version 51.0
The only idea I have is that the essential .jars I used to build the class file
(e.g., max.jar) are version 51.0 and do incompatible with Max 6.1.8
The problem is solved. My solution was to point Eclipse to Java SE 6 (version 1.6) which is
from Apple. The JVM should be in the /System directory on the Mac. All of the Oracle versions
(which can happily co-exist but not work with [mxj]) are stored under /Library. I wonder if the
root issue is where Apple’s Java was 32-bit and Oracle’s are all 64 bit? Oh, and run Max in
32bit mode (which it seems to be by default).
It would be nice to have [mxj] work with Oracle’s versions of Java to keep things up to date.
Currently, the latest development version is 1.8
I’m not a regular Mac user, but I need to edit this mxjpreferences.xml on my Mac so I can redirect Max to Java 1.6 and build out a standlone for OS X.
Where’s the file? I’ve searched the entire Max 6 application folder with no results.
On my Windows box it’s in the same folder as the max.java.config.txt ( /max 6.1/cycling ’74/java ), but on the Mac the xml doesn’t exist.
It should be inside this folder. (If you are working on command line check the spelling unlike on Windows Mac paths are case sensitive). But on Mac Max will only work with Java for OS X (not the Oracle Java) whose maximum version is 1.6 anyhow. If you are running 10.9 or later you’ll need to install it from here: http://support.apple.com/kb/dl1572
Hey Jan. Thanks for all the info. I actually went through this process with this exact Mac previously and have been using it on and off for testing over the last month without any issues. Nothing has changed except that I’ve updated to 6.1.9. Since then the Java components have been giving me that 51 error – hence why I checked back on this thread.
I’ve checked about 10 times now, but the "mxjpreferences.xml" definitely doesn’t exist anywhere in my Max folder structure.
Is there anywhere else I can change which Java version Max points to? Or perhaps you’d be willing to send me a copy of your mxjpref file for me to test.
Thanks for sending that through. That’s probably good advice though – after confirming the correct paths inside the xml you sent there was no change in my 51 error. I’ll go about reinstalling Max.
Fresh install of Max, still no mxjpreferences.xml in the "/max 6.1/cycling ’74/java/" folder. Could it be hidden or somewhere else?
I just remember that it is created i think when opening the the compile window for the first time.
I posted on this earlier too because I was having a similar problem. I don’t think it matters what is in
Cycling74/Java/mxjpreferences.xml because I have specified a 1.7 version in that file; however, I have been
running Version 8 of Java (the latest) without any issues for a couple of months. For reference, I am running
Eclipse and specify the version of Java to use in Eclipse->Preferences->Installed JREs (Java SE 8 is set as
default). I cannot recall why I was receiving the major.minor version 51 error. It may have been because I had
to set the SE 8 default and restart Max.
Many thanks for assist guys. I think I was slightly confused with the necessity of the mxjpreferences.xml then.
I’m actually building in Eclipse. Here’s the set up:
- In Terminal I’ve used the command to switch my JRE to 1.6.0_65 using:
export JAVA_HOME=$(/usr/libexec/java_home -v 1.6)
- Confirm is saved using java -version
- I’ve set 1.6.0_65 to be the Java version for my Eclipse project as well as setting 1.6 in the Eclipse preferences
- Set the dynamic class path in max.java.config.txt in the /max 6.1/cycling ’74/java folder to the location of the bin folder of my Eclipse project
I’m not sure if this is all necessary, but I think this is the same process I took last time for it to work, after I had the same issue when attempting to load my project with the MXJs in it.
Still no luck. Like I said before, I’ve been successfully working with Java/MXJ on this exact Mac system only a week back for this same project. The only thing I can recall changing is updating Max to 6.1.9.
The exact error is this:
Could not load class 'TMcore' java.lang.UnsupportedClassVersionError: TMcore : Unsupported major.minorversion 51.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637) at java.lang.ClassLoader.defineClass(ClassLoader.java:62) at com.cycling74.max.MXJClassLoaderImpl.doLoadClass(MXJClassLoaderImpl.java:119) at com.cycling74.max.MXJClassLoader.loadClazz(MXJClassLoader.java:88)
*edit: Note, I’m only ever calling the one class from my MXJ objects which is the TMcore class. The Eclipse project compiles with no errors using the 1.6.0_65.
What am I doing stupid here?
maybe check if you have the class twice in your class path… i don’t see any reasons how this could be related to the Max update. No changes in java stuff there.
Yes you’re right, it wouldn’t be any changes in the update, but perhaps it’s overwritten some config files that I’ve forgotten to change back.
I managed to get it working on another test Mac, so I’m guessing I fudged up the paths somewhere in my settings. Thanks again for all the help.
I’m struggling with the same issue whereas I absolutely need java 1.7 and I can’t tell maxmsp to use 1.7.
I have checked my osx yosemite java version which is greater than 1.7 but I still have the error 51.
Does anyone know how to tell maxmsp to use the current JDK of osx which is 1.8.0_25 ?
I have set the default java version to be used with my system by typing in the terminal :
/usr/libexec/java_home -v 1.7*
Checked with java -version
it displays :
java version "1.7.0_71"
I’ve also added in the max.java.config.txt file the following line :
but maxmsp still seems to use 1.6 as it return the same error 51
- This reply was modified 1 year by robotpapier.
still valid for Max 7:
If you find a hack to use Java 7 I’d be interested. But I believe, that Max uses a hardcoded path to the java executable. The Only thing you can change currently is the path for the compiler (javac) in ~/Library/Application Support/Cycling ’74/Max 7/mxjpreferences.xml
P.S.: Once I tried changing the "old" symlinks in /urs/bin but Max still loads the Apple Java. That’t why I believe it it hardcoded somewhere…
hey thanks for your reply.
yeah, I just realized the max version for max on osx is 1.6.
Will have to deal with it then :)
Forums > Java