java swing component cannot be resolved

前端 未结 9 2018
灰色年华
灰色年华 2020-12-11 16:43

I took the following code from a tutorial:

import javax.swing.*;
import java.util.Date;

public class SwingGUI {

    public static void main( String[] args          


        
9条回答
  •  北海茫月
    2020-12-11 16:51

    1. There must be an installed (and selected) JDK in Eclipse:

      Window > Preferences > Java > Installed JREs

    2. The project must be configured to use that JDK:

      Project > Properties > Java Build Path > Libraries

    3. there should be an entry like "JRE System Library [JDK7]" in the list. If not press:

      Add Library... > JRE System Library

    4. The project should have been created as a "Java Project":

      Project > Properties > Builders

      should include "Java Builder"

    SoCodeIt IDE Dr

提交回复
热议问题