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.
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
Related
I wanted to install protractor in order to work with our AngularJS project.
Everything went OK till I ran the command:
webdriver-manager start
...and I got some errors:
seleniumProcess.pid: 5421
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/openqa/grid/selenium/GridLauncher : 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)
Selenium Standalone has exited with code 1
Then I understood that I was using the wrong version of java (1.6.0_65).
So Ive got the latest one (1.8)
and basically the problem was that on terminal it would show me the old version. but on my actual computer would show me the latest.
However I tried uninstalling java by running this command:
sudo rm /usr/bin/java
and been getting this, no matter what I do.
sudo rm: /usr/bin/java: Operation not permitted
Has anyone experienced the same thing?
(Using OS X 'El Capitan' as my operating system)
You are using a mac and the default version of Java on mac osx is still Java 6 (Apple stopped producing their own version of Java a number of years ago). So, you need to manually install a more recent version of Java from Oracle to get the latest version.
Download the latest version of Java here. Then, run the downloaded dmg file and follow the instructions to complete the installation.
After installing Java 8, simply re-run webdriver-manager start and you should be good to go.
We are creating a runnable java jar to run on a beagle bone black(running ubuntu).
We have created a runnable jar which runs fine on our mac and pc(windows) but will not run on the ubuntu system. We keep getting the following error when running:
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: java.lang.UnsatisfiedLinkError: /home/ubuntu/.jssc/linux/libjSSC-2.6_armhf.so: /home/ubuntu/.jssc/linux/libjSSC-2.6_armhf.so: cannot open shared object file: No such file or directory
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1965)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1890)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1851)
at java.lang.Runtime.load0(Runtime.java:795)
at java.lang.System.load(System.java:1062)
at jssc.SerialNativeInterface.<clinit>(SerialNativeInterface.java:172)
at jssc.SerialPort.<init>(SerialPort.java:118)
at InputBoard.<init>(InputBoard.java:33)
at InputBoard.main(InputBoard.java:22)
... 5 more
Any information would be greatly appreciated. As I said this runs fine through terminal on a mac which is unix based so it seems it should work on Ubuntu. We have no idea why it is referencing the /home/ubuntu directory. Please let us know if you need any code information on the project but I would not think it would be related.
You are missing a native runtime library. You can install this library by using apt-get to fetch the package it contains. To do this, give this command.
sudo apt-get install libc6-*
I fixed this problem when I installed the latest JDK 8 for Hard float for Arm. Previously I tried several things, I tried using versions 2.6, 2.7 and 2.8, specified LD_LIBRARY_PATH env. variable, making sure that library was in ~/.jssc/linux, etc, etc all this to no avail, only after I upgraded java, it worked flawlessly.
I had this same error even with the latest version. In my case it turned out to be that JSSC was trying to use the "soft float" version of the native libraries that it copies out of the .jar file. I ended up replacing the file with the hard float version from the .jar file and removing write access to the file. Everything started working after that.
Every time I start Eclipse on my laptop running Fedora 20, a new log file is created in the same folder where Eclipse was started with a name like abrt_checker_xxxx.log where xxxx is a different 4-digit number. Inside the log file there is always the same error:
Uncaught java.lang.ClassNotFoundException exception in thread "main" in a method java.lang.ClassLoader.loadClass() with signature (Ljava/lang/String;Z)Ljava/lang/Class;
Exception in thread "main" java.lang.ClassNotFoundException: .home.raffy.eclipse..plugins.org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar
at java.net.URLClassLoader$1.run(URLClassLoader.java:366) [jar:file:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.3.0.fc20.x86_64/jre/lib/rt.jar!/java/net/URLClassLoader$1.class]
at java.net.URLClassLoader$1.run(URLClassLoader.java:355) [jar:file:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.3.0.fc20.x86_64/jre/lib/rt.jar!/java/net/URLClassLoader$1.class]
at java.security.AccessController.doPrivileged(Native Method) [jar:file:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.3.0.fc20.x86_64/jre/lib/rt.jar!/java/security/AccessController.class]
at java.net.URLClassLoader.findClass(URLClassLoader.java:354) [jar:file:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.3.0.fc20.x86_64/jre/lib/rt.jar!/java/net/URLClassLoader.class]
at java.lang.ClassLoader.loadClass(ClassLoader.java:425) [jar:file:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.3.0.fc20.x86_64/jre/lib/rt.jar!/java/lang/ClassLoader.class]
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) [jar:file:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.3.0.fc20.x86_64/jre/lib/rt.jar!/sun/misc/Launcher$AppClassLoader.class]
at java.lang.ClassLoader.loadClass(ClassLoader.java:358) [jar:file:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.3.0.fc20.x86_64/jre/lib/rt.jar!/java/lang/ClassLoader.class]
This happens when running Eclipse on both OpenJDK 7 and Oracle JDK 7. It did not happen when I had Fedora 19 with the same exact set up.
Not really an answer to your question, but I have always seemed to have had issues using OpenJDK in linux for eclipse and netbeans. I never could really pinpoint the issue because there were always different issues, and the issues did not always persist. I ended up finding a repository to get and use the standard Java Development kit.
Which for the most part played much nicer.
I was able to eliminate the symptoms only (the log file being created after every Eclipse start) by removing a package called abrt-java-connector from Fedora.
sudo yum remove abrt-java-connector
Like I said, this only removes the symptoms. The underlying problem is either with Fedora 20 or Eclipse and hopefully can be resolved in future versions.
The problem is not related to my set up because I was able to recreate the same problem by doing a fresh install of Fedora 20 and a fresh install of Eclipse on a completely separate laptop.
I suggest you to read the Known Issues section of the readme_eclipse.html file which is located in eclipse/readme folder. It surely suggests which jdk version is required for your current eclipse installation and you may check if it matches. I strongly believe that your eclipse has mismatches with JDK like 64-bit version of jdk and 32 bit eclipse, or vice versa.
ADD path of jre and bin:
Fix JAVA_HOME as well as PATH variables ?
Do you have Google Talk installed? If so, try uninstalling it and try again. It's a webkit issue on Fedora 20.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=334466
It's an issue with gtk styles, probably you are using KDE and the gtk theme is oxygen-gtk.
Try setting the themes to defaults. It worked for me.
rm .gtkrc-2.0*
Sources:
http://forums.fedoraforum.org/showthread.php?t=295967
https://bbs.archlinux.org/viewtopic.php?pid=1363455#p1363455
http://forums.zend.com/viewtopic.php?f=59&t=114903
I'm in CentOS 6.3 and I'm attempting to recompile a .java file using the ant command however I'm getting these two results.
When I run ant:
Caused by: java.lang.ClassNotFoundException: org.apache.tools.ant.launch.Launcher
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: org.apache.tools.ant.launch.Launcher. Program will exit.
When I run sudo ant:
Error: JAVA_HOME is not defined correctly.
We cannot execute java
When I run *echo $JAVA_HOME*:
/usr/lib/jvm/java-1.6.0-openjdk/
Before anyone suggests that I should be using the JRE instead of the JDK, I just need to mention that my installation manual for the software I'm running - OpenGTS - specifically requests the JDK. Any ideas as to what I'm doing wrong?
Thanks in advance.
ant is script to launch a java program. It appears that script could not figure out a value for ANT_HOME. On linux the script tries to load /etc/ant.conf which reset the ANT_HOME. Your symptoms does not match, but it is worth checking.
Quote from site
The cause of this is that there is an old version of ant somewhere in
the class path or configuration.
A version of this problem may be seen on some linux systems. Some
linux systems (Fedora Core 2 for example), comes with a version of ant
pre-installed. There is a configuration file called /etc/ant.conf
which if present, the ant shell script will 'dot' include. On Fedora
Core 2, the /etc/ant.conf file resets the ANT_HOME environment
variable to /usr/share/ant. This causes the problem that an old
version of ant (1.5.x in this cause) will be used with a new version
of the ant script file.
One can check if this is the case by doing ant --noconfig -version.
I've seen other questions relating to this exact error, but they don't seem to help at all.
I'm coding an app to run on a Linux system (CentOS if I'm not mistaken), which has Java 1.5 version. I am currently editing the program on my Eclipse IDE on my Mac OSX system which has Java 1.6.
I compiled the project into a runnable .JAR file. When prompted with the option of what to do with the libraries in Eclipse, I choose "extract selected packages into .JAR file".
I know Eclipse has its own compiler, so in the project settings I changed the target compiler to Java 1.5 and rebuilt. And then repackaged the runnable jar file.
However, when running the .JAR file with "java -jar file.jar" on the target machine, I still get the aforementioned "Bad version number" error.
Can somebody help?
Full error is:
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
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:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
I am using only using one external library, sun-javamail.
Thank you
You either:
haven't recompiled everything with -target 1.5
haven't redeployed everything
are using third party JARs compiled for 1.6. The class named in the exception will tell you that.
You may want to run javap command on class file and check exact version of JDK for which it was complied.
For example:
C:\>javap -verbose Main
Compiled from "Main.java"
public class Main extends java.lang.Object
SourceFile: "Main.java"
minor version: 0
major version: 50
...
Following is the mapping between major version and jdk
MajorVersion JDK
51 J2SE 7
50 J2SE 6.0
49 J2SE 5.0
Reference: Class file format