lintool / warcbase

Warcbase is an open-source platform for managing analyzing web archives
http://warcbase.org/
161 stars 47 forks source link

Maven error #233

Open drjwbaker opened 8 years ago

drjwbaker commented 8 years ago

Mac, OS X El Capitan.

When doing anything with mvn in the Terminal I get the error:

Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/maven/cli/MavenCli : 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 org.codehaus.plexus.classworlds.realm.ClassRealm.loadClassFromSelf(ClassRealm.java:401)
    at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:42)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:254)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
    at org.codehaus.plexus.classworlds.launcher.Launcher.getMainClass(Launcher.java:144)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:266)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
anjackson commented 8 years ago

You need Java 7 installed (more info here)

drjwbaker commented 8 years ago

So I need 7 as well as 8?

anjackson commented 8 years ago

Ah, no. The error is consistent with Java 6 being the active version. What do you get if you print the Java version? e.g.

$ java -version
java version "1.8.0_20"
Java(TM) SE Runtime Environment (build 1.8.0_20-b26)
Java HotSpot(TM) 64-Bit Server VM (build 25.20-b23, mixed mode)
drjwbaker commented 8 years ago

java version "1.6.0_65" Java(TM) SE Runtime Environment (build 1.6.0_65-b14-468-11M4833) Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-468, mixed mode)

drjwbaker commented 8 years ago

(though elsewhere it says I'm on Java 8 Update 91)

anjackson commented 8 years ago

So, is the JAVA_HOME environment variable set?

echo $JAVA_HOME

Because that can override the system default.

If that's not set, then you should be able to change the system Java version via System Preferences.

drjwbaker commented 8 years ago

That does nothing.

drjwbaker commented 8 years ago

(that is echo $JAVA_HOME)

ianmilligan1 commented 8 years ago

Happy to help hack with it @drjwbaker while we're in the same room – but for example, my JAVA_HOME is

/Library/Java/JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home

(And when I've had to say downgrade Java for earlier versions of Gephi, etc., I manually override it to point to one of the other two versions of Java I have in /Library/Java/JavaVirtualMachines/)

drjwbaker commented 8 years ago

Thanks both! Don't mind hacking through these kind of problems but always good to flag them if they are generic.

ianmilligan1 commented 8 years ago

Yep, very very helpful. I will document this once you confirm that it works. 😀

anjackson commented 8 years ago

Two options I can think of. First, there's a hard-coded hook to Java 6 in your PATH. See

echo $PATH

Second, that Java 6 is set as your system default, which you change via the Java tab of the Java Control Panel which you can get to via System Preferences on OS X.

drjwbaker commented 8 years ago

Right. Back on this. echo $PATH gives me: //anaconda/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/munki:/Library/Application Support/pinpoint/bin Can't see how to change to change my version of Java in the Java Control Panel.

anjackson commented 8 years ago

It's there I promise!

Failing that, you can set JAVA_HOME as shown here: http://stackoverflow.com/a/24657630

anjackson commented 8 years ago

It's under "Java Runtime Environment Settings", as noted here https://java.com/en/download/help/mac_controlpanel.xml - see second image on this page for what it should look like: http://stackoverflow.com/questions/14304996/java-7-jre-installed-but-not-enabled-on-osx-mountain-lion

drjwbaker commented 8 years ago

I'd found that. Won't let me change Java's though. I just see 1.8.0_91. Do I need to install a different version of Java then? (stops Macs et cetera!)