I can’t get Joptionpane on Eclipse

Asked

Viewed 1,902 times

1

Guys, I can’t seem to call JOptionPane in no eclipse class, tried in Netbeans, and ran normal. Someone there may know what might be?

Error message:

Multiple markers at this line - Access Restriction: The type Joptionpane is not accessible due to Restriction on required library C: Program Files Java jre1.8.0_73 lib rt.jar - Access Restriction: The method showMessageDialog(Component, Object) from the type Joptionpane is not accessible due to Restriction on required library C: Program Files Java jre1.8.0_73 lib rt.jar

Code:

package br.projeto.model;
import javax.swing.*;
public class Caixa {

Cliente client = new Cliente();

public void showAvaibleBalance(Cliente client){
    client.getBalance();
}

public void makeLoot(Cliente client, double value){
    if((value > 0)&&(value < client.getBalance())){
        client.setBalance(client.getBalance()-value);
    }else if (value < 0){
        JOptionPane.showMessageDialog(null, "");
    }
}
}
  • 1

    Man, solved ! Thank you so much !! I was going crazy kkkk

1 answer

3


Perform the following procedures to resolve this problem:

  1. Menu "Window" -> "Preferences"
  2. In the window that opens, expand "Java" -> "Compiler" and choose "Errors/Warnings"
  3. On the right side expand "Deprecated and Restricted API" and on "Forbidden Ference (access Rules)" choose "Ignore"
  4. Click on "OK"
  5. Eclipse will ask for confirmation. Choose "Yes" and wait for it recompile the classes.

Source: http://respostas.guj.com.br/33156-erro-joptionpane

Browser other questions tagged

You are not signed in. Login or sign up in order to post.