0
votes

I'm trying to install Amazon Mechanical Turk command line tools on Ubuntu 14.04 LTS, using this tutorial. It requires Java, so I installed OpenJDK7. However, when attempting to run the command , I get the following error, which the internet informs me indicates the wrong Java version.

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:621)
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:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
at com.amazonaws.mturk.service.axis.AWSService.<clinit>(AWSService.java:104)
at com.amazonaws.mturk.cmd.AbstractCmd.initService(AbstractCmd.java:119)
at com.amazonaws.mturk.cmd.AbstractCmd.run(AbstractCmd.java:143)
at com.amazonaws.mturk.cmd.GetBalance.main(GetBalance.java:28)

Some of the documentation for the AMT tools indicates that I need JRE 1.5 (while others say "most recent version"), so I have been trying to install that. Since it's no longer available through apt-get, I downloaded the bin file and installed it at '/home/USERNAME/', (I don't use the machine much and didn't want to deal with sticking it at the end of a long chain of folders, so all my AWS stuff is in there) then put in my AWS keys and set the environment variables:

export JAVA_HOME="/home/USERNAME/jre1.5.0_22"
export MTURK_CMD_HOME="/home/USERNAME/aws-mturk-clt-1.3.1" 

Then, checking my balance to make sure everything is configured, as specified in the AWS Getting Started PDF, I still get the same error shown above.

Did I do something wrong when installing JRE 1.5? Is it still using OpenJDK7, or is JRE 1.5 also no good? I'm really at my wit's end here.

1
Java is backwards compatible, so anything that will run on 1.5 will run on 1.7.Kayaman
Use java -version to see which version you're using. It's not always the one you think.Kayaman
java -version says 'The program 'java' can be found in the following packages: * default-jre * gcj-4.8-jre-headless * openjdk-7-jre-headless * gcj-4.6-jre-headless * openjdk-6-jre-headless'Chris
So you didn't install openjdk7 with apt-get I assume.Kayaman
No, JRE 5 wasn't available through apt-get. But I've figured out my own question anyway-- thanks for the help.Chris

1 Answers

0
votes

It turns out that I am an idiot and installed Java wrong.

Instructions for anyone else having this problem: http://www.webupd8.org/2012/09/install-oracle-java-8-in-ubuntu-via-ppa.html