• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Bear Bibeault
  • Liutauras Vilda
  • Devaka Cooray
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Henry Wong
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

Why javax.swing is not accessible in JDK 13 , but accessible in n JDK 8 in Eclipse

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why is javax.swing not accessible in JDK 13 , but accessible in JDK 8/7 in Eclipse , as you can see in the picture
jdk-12.PNG
[Thumbnail for jdk-12.PNG]
 
Rancher
Posts: 858
20
Netbeans IDE Oracle MySQL Database Tomcat Server C++ Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not so--Just looked, they still list javax.swing is still in the API list in 13... so maybe a bug in Eclipse?

Without checking any further, so take it for what this is, MO and no validated, Oracle has been looking to drop SWING and AWT for a while, maybe in 13 they decided it was time?  Check the Docs and see what they say.  I'm still sticking in 8.x
 
Saloon Keeper
Posts: 11441
247
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Swing is still part of the JDK, but since Java 9 the standard API has been split over multiple modules. Swing is part of the java.desktop module, which is NOT included by default. You must edit your module-info.java to require java.desktop.
 
Stephan van Hulst
Saloon Keeper
Posts: 11441
247
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Note that if you get an error message about something not being "accessible", rather than something not being "found", it usually means that the compiler knows where the class files are, but it's not allowed to use them because of your module-info.java.

Oh and welcome to CodeRanch!
 
Rancher
Posts: 144
9
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
just get rid of that module crap and use java as it was before project jigsaw
 
Gourav Das
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Les Morgan wrote:Not so--Just looked, they still list javax.swing is still in the API list in 13... so maybe a bug in Eclipse?

Without checking any further, so take it for what this is, MO and no validated, Oracle has been looking to drop SWING and AWT for a while, maybe in 13 they decided it was time?  Check the Docs and see what they say.  I'm still sticking in 8.x



Yeah ,  me too , still sticking with 1.8 , can't really grasp this modularity
 
Gourav Das
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Stephan van Hulst wrote:Note that if you get an error message about something not being "accessible", rather than something not being "found", it usually means that the compiler knows where the class files are, but it's not allowed to use them because of your module-info.java.

Oh and welcome to CodeRanch!



Removing module-info.java really worked out , thanks  but , still couldn't figure out why was it creating problem... Well im in search of an answer and hopefully will find one soon!!

Furthermore , i know this is not an eclipse group , but still im asking since we all use Eclipse/NetBeans , i dont have an option to create a default class , i have to choose public / private / abstract .. etc as you can see in the picture...


This creates problem when we are inheriting different .java files classes since only one class can be public  ,... i have to manually select public from the checkbox and then just use backspace to remove the word public , not a big problem.. just Saying
help.PNG
[Thumbnail for help.PNG]
 
Gourav Das
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Kristina Hansen wrote:just get rid of that module crap and use java as it was before project jigsaw



Yes thank you
 
Stephan van Hulst
Saloon Keeper
Posts: 11441
247
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Kristina Hansen wrote:just get rid of that module crap and use java as it was before project jigsaw


I think that's a very limited view of the world. Jigsaw works just fine, especially if everyone pitches in and takes the time to write proper module descriptors for their libraries. The advantage is that your applications are much more descriptive in what dependencies they need, making your binary releases potentially much smaller.
 
Stephan van Hulst
Saloon Keeper
Posts: 11441
247
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gourav, if you at some point in the future decide to write libraries for other people to use, please take the time to learn about Java's module system. Getting rid of module-info.java in general is not a good idea. It's mostly just a lazy fix.
 
Stephan van Hulst
Saloon Keeper
Posts: 11441
247
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Gourav Das wrote:i dont have an option to create a default class , i have to choose public / private / abstract .. etc as you can see in the picture...


The default visibility is called "package private". You need to use the radio button that says "package".
 
Gourav Das
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Stephan van Hulst wrote:Gourav, if you at some point in the future decide to write libraries for other people to use, please take the time to learn about Java's module system. Getting rid of module-info.java in general is not a good idea. It's mostly just a lazy fix.



Ok , will keep in mind I'm just a beginner , but im old like 24.. I know im late in computing , but i find it fun , kind of my newly discovered passion after 24 years..
 
Stephan van Hulst
Saloon Keeper
Posts: 11441
247
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Glad you're enjoying it. Make sure to put up your code for peer review, it's one of the best ways to improve.
 
Marshal
Posts: 25143
64
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Stephan van Hulst wrote:... please take the time to learn about Java's module system...



That was part of Java 9, wasn't it? And I notice that Java 14 has just been released. So yes, it shouldn't be a terribly avant-garde idea to learn about the module system.
 
Stephan van Hulst
Saloon Keeper
Posts: 11441
247
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess it's comparable to using packages.

Yes, you can write Java applications by dumping everything in the root package, and pretend packages don't exist.

Should you?
 
You got style baby! More than this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!