Forums > Java

Unsupported major.minor version 51.0 ERROR when running MXJ quickie

March 1, 2012 | 5:33 pm

Hi,

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.

Thank you!
Tsuki


March 4, 2012 | 12:13 pm

You haven’t specified whether you’re in OS X or Windows, but I can tell you how to do it inside Java itself:


System.getProperty("java.version");

You’d have to Google to match class file versions against Java versions/releases. I have some code for examining that somewhere.


November 10, 2012 | 5:11 am

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


August 14, 2014 | 9:58 pm

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:

<map>
<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"/>
</map>

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


August 15, 2014 | 9:43 am

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


October 18, 2014 | 9:33 pm

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.



Jan
October 19, 2014 | 3:33 am

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


October 19, 2014 | 4:12 am

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.



Jan
October 19, 2014 | 4:18 am

i guess something might have gone wrong with the update. I’ve attach you my mxjpreferences.xml but it’s probably a good idea to run a clean reinstall. Other things might have gone wrong…

  • This reply was modified 2 days by  Jan.

October 19, 2014 | 5:12 am

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.


October 19, 2014 | 5:38 am

Fresh install of Max, still no mxjpreferences.xml in the "/max 6.1/cycling ’74/java/" folder. Could it be hidden or somewhere else?



Jan
October 19, 2014 | 5:47 am

I just remember that it is created i think when opening the the compile window for the first time.


October 19, 2014 | 8:47 am

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.



Jan
October 19, 2014 | 8:56 am

@chris: do you already have a class compiled with a later version than 1.6 with the same name you use for the quickie in your class path? that was would explain the error as max would try to load the existing class.


October 19, 2014 | 4:22 pm

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 (which I can 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?



Jan
October 19, 2014 | 4:51 pm

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.


October 19, 2014 | 7:54 pm

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.


Viewing 17 posts - 1 through 17 (of 17 total)