Reputation: 105
I'm on the Eclipse program for Java developers, and for some reason, Eclipse doesn't recognize import javax.swing.JOptionPane
when creating a new class.
If you attempt to make a new class and have the code imported automatically, nothing pops up
In fact, nothing remotely related to javax.swing
pops up. Any ideas on what's going on? I removed the JRE system library and re-added it again. But that didn't work.
Upvotes: 2
Views: 8250
Reputation: 3874
Here are some things that could be causing a problem:
Make sure you have a JDK installed and selected in eclipse
Window > Preferences > Java > Installed JREs
Make sure it’s in your build path
Project > Properties > Java Build Path > Libraries
One of the Libraries should be something along the lines of “JRE System Library [JDK9]”. If there isn’t one, add it with:
Add Library > JRE System Library
Your project should be a Java project
Project > Properties > Builders
Should have a “Java Builder” entry.
After doing all that, rebuild your project with Project > Clean
then select your project. If none of that works, completely uninstall Java, reinstall the JDK and JRE then repeat steps 1-3. Source.
Upvotes: 1