Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't import java.awt.* and javax.swing.* in Intellij

The title said it all. I can't import neither java.awt.* nor java.swing.* in Intellij Idea. This is my project structure.

project structure

java version "9.0.4"
Java(TM) SE Runtime Environment (build 9.0.4+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11, mixed mode)
like image 777
m.d Avatar asked Oct 16 '25 04:10

m.d


1 Answers

This is how i done it. It seems that i need to include a module-info.java file

module-info.java

and inside that put the follwoings.

module project.name {
    requires java.datatransfer;
    requires java.desktop;
}

I can't come up with a better answer right now. but this solved the initial problem.

like image 108
m.d Avatar answered Oct 18 '25 06:10

m.d