• 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
  • Liutauras Vilda
  • Bear Bibeault
  • Junilu Lacar
  • Martin Vashko
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Scott Selikoff
  • salvin francis
  • Piet Souris

Java 9 and modularity

 
Ranch Hand
Posts: 77
1
  • 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?
 
Greenhorn
Posts: 17
6
  • 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.
 
I'm so happy! And I wish to make this tiny ad happy too:
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!