I took the following code from a tutorial:
import javax.swing.*;
import java.util.Date;
public class SwingGUI {
public static void main( String[] args
Updating the execution environment under system library to JavaSE-1.7 or JavaSE-1.8 in eclipse should solve the problem. To update the step below can be followed:
> Right-click on the project
> Select properties
> Java build path
> Library > Add Library > Add JRE SYSTEM Library
> Execution Environment
> Select JavaSE-1.7 or JavaSE-1.8
> Finish