• 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 ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Java 9 and modularity

Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In order to use Java 9, my understanding is java doesn't prevent one from doing away with using modules
is that a correct statement?
Posts: 17
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On Java 9+, the module system is always in play and there's nothing you can do about it. That is most obvious when you try to compile code that imports a class from an internal API (e.g. from a sun.* package) on such a version - it will fail due to strong encapsulation of (JDK) modules (unless you add JPMS-specific command line arguments).

But: You don't have to create modules at all. As long as you place your code and your dependencies on the class path, they all end up in the so-called unnamed module and there will be no encapsulation between them, the module system will not check presence of dependencies, split packages are ok, and so on and so forth. As the JDK team put it, "the chaos of the class path" lives on inside the unnamed module. But that doesn't mean the module system is not active - it is, just not within your code.
What do you have in that there bucket? It wouldn't be a tiny ad by any chance ...
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic