访问限制:由于对所需库的限制 /opt/java/ 错误,无法访问类型 JFrame

Access restriction: The type JFrame is not accessible due to restriction on required library /opt/java/ error

我在网上搜索了这个问题,发现许多线程提供了接近我一直遭受的问题的解决方案。

我收到如下所述的访问限制错误: 访问限制:由于所需库 /opt/java/jdk1.8.0_31/jre/lib/rt.jar

的限制,无法访问类型 JFrame

在我的代码中,JFrame和JPanel下面有红线

我做了这些线程中要求的操作,但问题仍未解决 Access restriction: The constructor Provider() is not accessible due to restriction on required library jdk1.6.0\jre\lib\jsse.jar?

Access restriction: Is not accessible due to restriction on required library ..\jre\lib\rt.jar

JFrame Restricted due to restriction on required library

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;


public class WelcomePage extends JFrame {

    private JPanel contentPane;

    /**
     * Launch the application.
     */
    public static void main(String[] args) {
        EventQueue.invokeLater(new Runnable() {
            public void run() {
                try {
                    WelcomePage frame = new WelcomePage();
                    frame.setVisible(true);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
    }

    /**
     * Create the frame.
     */
    public WelcomePage() {
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setBounds(100, 100, 450, 300);
        contentPane = new JPanel();
        contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
        contentPane.setLayout(new BorderLayout(0, 0));
        setContentPane(contentPane);
    }

}

我是运行linux薄荷32位

我的 Java 版本是: java 版本“1.8.0_31” Java(TM) SE 运行时环境(build 1.8.0_31-b13) Java HotSpot(TM) 服务器虚拟机(内部版本 25.31-b07,混合模式)

我找到了绕过这个问题的方法,但顺便说一下,这不是一个具体的解决方案。它仍然可以完成工作。由于没有错误,我现在可以编译我的代码了。这个link:

中提到了解决方案

A workaround to the problem

接受有关此问题线程的更多建议!