javax.swing.JOptionPane dont want to import
I want to make the programm that I screened and I don't understand why it don't want to import JOptionPane...
Could someone help me pls ?
18 Replies
⌛
This post has been reserved for your question.
Hey @"Pom'! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose Post
button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
did you try importing like this
i'll try it
Do you have a module-info.java?
If yes, add
requires java.desktop;
in itidk what that is
check your src folder
I think there's a module-info.java file there
So your application is a module, libraries consist of modules and the JDK contains multiple modules. The module-info.java file specifies which modules your module (your application) is allowed to access
When creating a Java project, Eclipse has an option for that actually
If you hover the error, it would say something like
package javax.swing is not accessibleand also include a quick fix saying something like
add "requires java.desktop" to module-info.javaSelecting that option does the same - it edits the module-info.java file and configures it in a way that accessing Desktop/Swing packages is allowed
yea do what daniel said if my thing didnt work
it don't work x)
how do I add it ?
it seems to be the solution
Can you show your module-info.java?
it probably looks similar to
where do I find this ?
Oh I found it
so within the
{}
, add a requires java.desktop;
it's imported thanks
If you are finished with your post, please close it.
If you are not, please ignore this message.
Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
Post Closed
This post has been closed by <@204032198360170496>.