Solve JOptionPane error in Eclipse:
(1) Error while importing library javax.swing.JOptionPane as shown below.

(2) Now go to the Project tab which is provided at the top and click on Properties as shown below.

(3) Now click on Java Build Path → Libraries → Add Library.

(4) New pop-up window opens and then select JRE System Library and then press Next.

(5) Now select the Execution environment button and from the drop-down menu select library as shown below. Note: whatever version you installed, always try to import a library that contains the value 1.7 to solve this error.


(6) Now click on Apply and then click on Apply and Close as shown below.

(7) Now JOptionPane is visible as shown below.

(8) Error is solved.

Comments (No)