0

I have started using jena api and written a simple program like this

  package tutorial;  
  import com.hp.hpl.jena.rdf.model.Model;
  import com.hp.hpl.jena.rdf.model.ModelFactory;
  public class HelloRDFWorld {

/**
 * @param args
 */
public static void main(String[] args) {
    // TODO Auto-generated method stub
    Model m=ModelFactory.createDefaultModel();

  }

 }

but i am getting this exception

  Exception in thread "main" java.lang.UnsupportedClassVersionError: com/hp/hpl/jena/rdf/model/ModelFactory : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:643)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
at tutorial.HelloRDFWorld.main(HelloRDFWorld.java:11)

I know this is because of higher java version during compilation as compared to run time.But how to resolve that in eclipse

When I try to use

sudo update-alternatives  java

it shows

 only one config 
aditi rana
  • 35
  • 6
  • I have already tried that it is not working for me – aditi rana May 14 '15 at 16:07
  • This question was indeed related to apache jena(simple java programs are running fine) thats why I had added it.Also I had tried other gien options given in the earlier post but nothing worked for me.I found the reason that apache jena required 1.7 version and I was using 1.6.Once I installed 1.7 and changed the version in window->pref->installed jre ,it started working for me – aditi rana May 14 '15 at 17:41

0 Answers0