We are going to have a look at the jvms basics five module one this time which tries to solve the problems we had in the previous versions. As mentioned in the previous video, we have tried to have our project in different modules so that they could be exported and required by the other modules as before this jvms basics five module one as a source folder, which inside that one we have calmed easy to cache courses. And inside that one we have course as the interface we have draft course, as you see here is just an implementation of the draft course simulating the play for a draft video and they have published course the same as before, and it's going to be again implementing the course interface and providing implementation for some kind of simulation of playing a published video and we have these module dash input Java which is going to be expressing the name of the module which is called easy to catch courses and as you see export the only package we have in this module which is called the cash courses, then we have This jvms basics five module two, which inside this one, we have two packages the same as before, again comm that is it to cache that libraries dot draft which has these draft courses library and as you see here, we could use the load library and play library methods of this class in order to play the draft courses inside our library.
We have comm that is a cache that libraries that published having these class publish courses library, as you see here, the same as draft courses library, but this one has at least a publish courses. And the same we could use load library to load all the courses and call these play library to play all the published courses for us. As mentioned here, this module comm that is to catch our libraries exports both packages published and draft sub packages inside this module to whichever module which requires these two packages in order to use their functionality. And at the same time, this same module requires the previous one come to these two casual courses and again, as you remember, from the previous video, not only we have to mention it here, but also we should go to the folder of the project and then right click go to the build path and then go to the Configure build path.
And in here, you should explicitly mentioned that this module requires jpm as basics module one, by the way, this is the way we do it in Eclipse. If you're using some other IDE like IntelliJ IDEA, there will be the same concept and you need to do some kind of similar thing in the other environments. For now forget about the comment we're going to be returning back to this one when we have these jvms basics five, module three inside that one we have the only package column that is to cache dot tools dot player which has internal player and in this internal player, we should have access to both library staff courses and published courses because there's going to be some kind of player for the admin of our website and the admin should be able to play all the courses whether they're draft or published inside our libraries.
Therefore, in the module dash info we have mentioned that this is the name of the module. This module requires the module comm that is application code libraries. And then we have JP ms basics five, module four. In this one, we have comm that is the cash that user the tools that player which in this one, we have user player and we talked about the problem, it shouldn't be the case, it shouldn't be the case that the user player inside this user, the tools package should have access to graph courses and publish courses library. It shouldn't be like this one, because the user player should be just capable of playing just the published courses, not the draft courses as well. And as you remember, we are stuck we had this module slash info inside this module.
And then we said require the libraries the same thing we had in the model dash infer from the previous module. Now the last piece of the puzzle is that if we go to this module dash info for the libraries package, there is this nice feature in the jaypee ms, which you could say I as this module calm that is it to cache those libraries. I'm exporting these package to all other modules that require me but I am exporting These column that is to cache that libraries don't draft because these are going to be just a draft courses in the library to only one unspecific other module, I could say, I'm going to export this package just to this module. And that's all. So now look at here. If I go to JP ms basics five, module three, which is going to be the Admin Tools, inside here, I've said I required that one.
And that one fully is been given to me because it's been mentioned here, not only this one, but also the draft courses library has been exported to me before the user player. If you look at it, here, you see the errors. Although we have mentioned we are trying to import these two packages. But as you seen here, the first one draft courses library can't be imported. And as you see in the URL message, it says the type conda easy to catch that libraries that draft a draft courses library isn't accessible. The reason is that in the module gash info of the second module, we have explicitly said that this package is just going to be expensive.
To this module, and then we resolve our problem as you see JP Miss is very capable, we have brought the access modifiers to the package level. And as you see here, we have the option to say which packages in our module should be exported to which other modules outside. And that's what we logically desired. Like getting the user player, we shouldn't have any access to the draft courses library. So if I comment out these lines of code, as you see, everything seems to be great. So I have this option, then in my internal player, run and play all the courses because I'm going to be the admin obvious easy to catch card.
But if I'm going to be just a user player, now that I've commented out these lines, I could have access just to the published courses library. And when I run as the end user, I will be just able to watch the published videos, not the draft courses any longer. The other thing I want to mention is that I just added these jvms basics five, module five, just to show you that if you have such kind of project, it seems to be a module but you don't have module there. Input anywhere in this project. So it's not actually a module in Java programming. So in this project, if I have the user player which tries to import the same published courses library it can do so there is there is this package, which includes the published courses library class is inside the module.
And if I want to use that one, I should have a module asking the module to be required by me. And since I haven't done so I couldn't use that one. So as you see in here, when you switch to modular kind of programming using a j PMS tools in Java nine plus you should follow the rules. So you can have a project which is not modular, and then try to import a class from a package inside some kind of module. So that was our solution to the problem we had and it's just the beginning. We just played around with some basic features of the jaypee ms, which enable us to bring the access modifier kind of thing to the package level using these modules and module programming now embedded inside the Java programming language starting today.
Have a night are much more you could do with jvms in Java nine plus, but these are just the basics which I talked about what modules are Why do we need modules and what is J PMS and how j PMS could give us some futures to overcome the problems we have regarding modular programming using our simple example.