MacOS – Exception in thread “main” java.lang.UnsupportedClassVersionError (Trying run Alda on OS X)

command linejavamacosmemoryterminal

I've hit a wall with trying to get Alda to run on OS X.

It's an executable I downloaded from here; then, as per the installation guide on GitHub, I ran chmod +x alda on it, and then moved it to my /usr/local/bin. After that, though, I've run into any number of issues:

  1. The first error I've been getting occurs whenever I try to run Alda from command line.

    Exception in thread "main" java.lang.UnsupportedClassVersionError: alda/Client : Unsupported major.minor version 51.0
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
        at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    logout
    
  2. I also got an Invalid memory access of location […] Segmentation fault error a few times, FWIW.

I've looked into Java version (I'm running java version "1.6.0_65"), tried updating, all to no avail.

How do I get around this?

Best Answer

There is a large highlighted first line of the installation instructions "You must have Java 7+ installed on your system in order to run Alda."

So install the JDK (not JRE) from Oracle as per Oracle's comment

The Java Runtime (JRE) that you download from java.com or oracle.com contains a plugin to run Java content from your browser. In order to use the command line tools, you will need to download the Java Development Kit (JDK). The JRE and JDK are separate and can coexist on your system. Only one JRE can be installed on Mac OS X. There can be multiple JDKs installed on a system, as many as you wish.