Will Vanderhoef
Will Vanderhoef

Reputation: 808

Play! Framework run throws UnsupportedClassVersionError

Background, this application is running on Play! Framework 1.2.4 on a Mac OS X 10.5.8

The command I'm running: sudo play run

The exception thrown:

Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:676)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:317)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:280)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:375)
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2357)
    at java.lang.Class.getConstructor0(Class.java:2671)
    at java.lang.Class.newInstance0(Class.java:321)
    at java.lang.Class.newInstance(Class.java:303)
    at play.plugins.PluginCollection.loadPlugins(PluginCollection.java:158)
    at play.Play.init(Play.java:294)
    at play.server.Server.main(Server.java:158)

The application.conf for the application and all dependent modules are set to java.source=1.6

sudo $JAVA_HOME/bin/java -version yields java version "1.6.0_26"

I've even pointed /System/Java/Home to the 1.6 installation.

What else could be causing this?

Upvotes: 2

Views: 1035

Answers (1)

Pere Villega
Pere Villega

Reputation: 16439

Which Java version(s) do you have in your PATH? We got a similar issue (not with Play, though) in which all the settings of the application seemed to point to 1.6 but the PATH had a reference to 1.5 that was loaded first due to its position inside the PATH string.

Check your PATH. And, I'm not a Mac user, but it's necessary to use sudo? In Ubuntu I run Play without. If possible, this may help to reduce unexpected conflicts due to root user paths and configuration.

Upvotes: 2

Related Questions