Why can’t NetBeans & Java find Swing’s contents?

Tags: ,



After over a decade, I decided to blow the dust off my university dissertation and get it working again.

Oddly, NetBeans can’t seem to find the libraries for javax.swing. Every single thing I imported for javax.swing can no longer be found with “cannot find symbol” for javax.swing.JFrame, javax.swing.JLabel etc.

I can’t find where the library would be to import it!

Should I be using a different version of the JDK? Do I have to download javax from somewhere and include it?

enter image description here

Answer

I managed to resolve this by downloading a different JDK (1.8, which I think contains JDK 8) from oracle. Works now. Maybe the other JDK I downloaded is too new, and there were changes to the packages, or maybe it didn’t include all the packages. Either way, done now.



Source: stackoverflow