CuriousPenguin
CuriousPenguin

Reputation: 97

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

I have searched the net for this problem and have found many threads that gave a solution close to the problem i have been sufferring.

I am getting a Access restrition error which is stated below: Access restriction: The type JFrame is not accessible due to restriction on required library /opt/java/jdk1.8.0_31/jre/lib/rt.jar

In my code, there are red lines below JFrame and JPanel

I did what was required in these threads but the problem is yet unresolved 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);
    }

}

I am running linux Mint 32bit

My Java version is: java version "1.8.0_31" Java(TM) SE Runtime Environment (build 1.8.0_31-b13) Java HotSpot(TM) Server VM (build 25.31-b07, mixed mode)

Upvotes: 1

Views: 3852

Answers (1)

CuriousPenguin
CuriousPenguin

Reputation: 97

I found a way to bypass this problem, but it's not a concrete solution by the way. It still gets the job done. I can compile my code now due to no errors. The solution is mentioned in this link:

A workaround to the problem

Open to any more suggestions regarding this problem thread!

Upvotes: 1

Related Questions