Doubts about the Caelum POO JAVA booklet

Asked

Viewed 157 times

0

Hello, I am studying the Java Object Orientation Caelum booklet and on page 131, I need to import a lib that I took from this link: https://github.com/fabiomsnet/fj11-contas/blob/master/lib/fj11-lib-contas.jar and importing it and executing this code below gives the error below.

package br.com.caelum.contas.main;

import br.com.caelum.javafx.api.main.OlaMundo;

public class Programa {

    public static void main(String[] args) {


        OlaMundo.main(args);

    }

}

Error:

Exception in thread "main" java.lang.UnsupportedClassVersionError: br/com/caelum/javafx/api/main/OlaMundo : Unsupported major.minor version 52.0
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    at br.com.caelum.contas.main.Programa.main(Programa.java:10)

1 answer

0

This is simple.
When they developed this library(lib), they used the Java 8 version in development. Thus the classes contained in lib were compiled in Java 8 and probably their JRE is earlier.
The JRE interprets until earlier codes the version of it (backward compatibility), but, future versions... gives no.
You need to upgrade your Java version to at least 8.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.