课程: Java 8+ Essential Training: Objects and APIs

今天就学习课程吧!

今天就开通帐号,24,600 门业界名师课程任您挑!

Include packages with modules

Include packages with modules

- [Narrator] One of Java 9's most important new features is the concept of API modularity. Known during development as Project Jigsaw, these tools let you break down your app and the core Java API into units known as modules. When you deliver an application you no longer have to deliver the entire core Java class library. Instead you only include what's needed. I'll demonstrate this with a new set of classes for making network requests. These tools were being developed during Java 9's development but at the time Java 9 was released, they were considered still to be in incubator status. So, they are not included in the core Java API files that you get with the SDK. There's a file called rt.jar, that stands for runtime.jar, that includes most of the classes that you typically call in a Java application. The new HTTP packages are not a part of that jar file. And if you want to include them you have to be explicit about it. In this application I have a constant that's pointing to this…

内容