To cut to the chase, when using Eclipse to learn the GUI interface of Java, there is an error with package introduction, as shown in the following figureThe main problem with the error is that the import package failedThe reason is that the modules generated when you create a Java project are ignoredmodule-info.java So we write the following code into the module file

module TestGUI {
	requires java.desktop;
}
Copy the code

When we return to our program, the error has been resolved, and the next step is to writeThere’s another, faster solution that we didn’t usemoduleThen, you can delete the file, can also remove the error!

Use of this package in subsequent code will clear the warning ⚠

Awt packages are not the only ones with this problem. In my later software testing experiments, the JUnit unit test package also had this problem. The solution was to delete the module-info.java file.