For my thesis I am trying to handle some things with pictures and one of the steps to complete it is to find corners in a picture. After some surfing I found that it can be implemented with Moravec's algorithm for corner detection. By luck, I found the Moravec's algorithm already implemented by JFeatureLib at this link: https://code.google.com/p/jfeaturelib/source/browse/src/main/java/de/lmu/ifi/dbs/jfeaturelib/pointDetector/Moravec.java?r=8d96a8fa9a43a0ec7e7084b40169be56bddd6f36
(Of course I imported the jar file given from JFeatureLib in the build path of Eclipse) So I used the code at the link in my project, and wrote some code to call it. Here is the code in which I create a Frame, open the picture and call the Moravec algorithm at that link:
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
public class Compare{
public Compare(){
JFrame frame = new JFrame("Find corners in picture");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel panel = (JPanel)frame.getContentPane();
JLabel label = new JLabel();
label.setIcon(new ImageIcon("house.jpg"));
panel.add(label);
frame.setLocationRelativeTo(null);
frame.pack();
frame.setVisible(true);
}
public static void main (String[] args){
SwingUtilities.invokeLater(new Runnable(){
public void run(){
new Compare();
}
});
Moravec picture = new Moravec();
}
}
The point is that it returns an error on the line
Moravec picture = new Moravec();
the error it's like this:
Exception in thread "main" java.lang.UnsupportedClassVersionError: de/lmu/ifi/dbs/jfeaturelib/pointDetector/PointDetector : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$000(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$000(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at Compare.main(Compare.java:32)
Could you please give me some advices? Thanks a lot!
Unsupported major.minor version 51.0
You are trying to run a jar compiled with a newer Java version in an older Java version. The message suggest de/lmu/ifi/dbs/jfeaturelib/pointDetector/PointDetector
was compiled using JDK7, but you are trying to run it with an older version (I'm guessing Java 6).
Execute java -version
and see if this the case. If so, find the JDK7 on your system and use that instead to run your program.