How to Fix the Package javax.swing is Not Accessible Eclipse - Java Swing Not Working | Step by Step

Опубликовано: 13 Февраль 2026
на канале: SoftTrick
4,987
109

Code:- requires java.desktop;

In This Video We Will See How to Fix the Package javax.swing is Not Accessible Eclipse or Java Swing Not Working in Eclipse

Here Are The Steps to Fix the Package javax.swing is Not Accessible Eclipse or Java Swing Not Working in Eclipse

Method 1

1. Double-Click on module-info.java to Open it
2. Between Curly Brackets Type requires java.desktop; Inside Module Tag Under module-info.java File (Code in Description)
3. Now Press Ctrl+S to Save the File
4. Go Back to Your Main Project File
5. Run The Program
6. Done!


Method 2

1. Right-Click on Project Folder
2. Click Properties
3. Click Java Build Path
4. Click Libraries Tab
5. Click Modulepath
6. Click Add Library Button
7. Make Sure JRE System Library is Selected
8. Click Next Button
9. Click Execution Environment To Select it
10. Click Finish Button
11. Click Apply Button
12. Click Apply and Close Button
13. Run the Program
14. Done!


Method 3

1. Delete module-info.java File
2. Click OK Button
3. Run the Program
4. Done!