I'm following a Java's Swing course and I'm trying a simple application.
package gui_01;
import java.awt.EventQueue;
import javax.swing.JFrame;
public class SimpleEx extends JFrame{
public SimpleEx( ) {
initUI();
}
private void initUI() {
setTitle("Simple example");
setSize(300, 200);
setLocationRelativeTo(null);
setDefaultCloseOperation(EXIT_ON_CLOSE);
}
public static void main(String[] args) {
EventQueue.invokeLater(() -> {
var ex = new SimpleEx();
ex.setVisible(true);
});
}
}
but I get this error when trying to run the application:
Exception in thread "main" java.lang.UnsupportedClassVersionError: gui_01/SimpleEx has been compiled by a more recent version of the Java Runtime (class file version 54.0), this version of the Java Runtime only recognizes class file versions up to 52.0
I have the following configurations for the project:
And if I run the command java -version
from the terminal I get the following result:
What can I do to solve it? I'm using :
- Mac: High Sierra
- Eclipse: 2018-09 (4.9.0)