Reputation: 263
When I copy codes from one file and paste it to another, a message dialogue opens as "Import Classes" says, "Pasted code refers to the following not imported elements, resolve imports to include them?"
After "OK" then IDE gives message, as in following images (since one does not need to import java.lang classes),
and,
IDE otherwise compiles and runs correctly with no problem.
Environment : NetBeans IDE 8.0 running Java programs on Windows 8.1, Java (JRE, JDK) 8.xx
Upvotes: 0
Views: 1566
Reputation: 263
I could ignore if the warning was not persistent or had a check box for not showing the message anymore.
Already, unrelated to this warning, I needed to upgrade Java JDK. So I uninstalled NetBeans 8.0 and Java JDK all together. I installed the latest JDK and installed NetBeans 8.0.2. Now it works fine.
I suppose copying automatic code lines created by NetBeans IDE visual forms and paste them in another file may cause such a problem. At the moment I have no such issue.
Upvotes: 0
Reputation: 12883
In a Java file, the java.lang
package is implicitly imported, so the suggestion that you should add imports for any java.lang
class is not a good suggestion.
If you see that, you should ignore it.
It looks like there's a bug report on this issue.
Upvotes: 1
Reputation: 1473
There is no so serious problem. Hint and importing classes on paste are unrelated, simply importing classess functionality not checks from where it imports classes.
Upvotes: 0