From the course: Advanced Java Programming
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Creating a module in Java - Java Tutorial
From the course: Advanced Java Programming
Creating a module in Java
- [Instructor] In this example, I have a very simple Hello World application. I want to make it modular. My program has one package called helloworld, and one class called Greeting. This just has a main method that prints out Hello World. All I need to do to make it modular is add something called a Module Info file. This is the file that will describe my model and how it relates to other modules. To do this in NetBeans, I just right click on my projects in the Projects window on the left, and select new, and then Java Module Info. A popup window appears which tells me that the name of my file will be module-info. This name can't be changed, and this type of file will always have to be called module-info.java. So, I just need to click on Finish. Now I have a very simple modular application with the module-info file. Just having this file in existence makes it a modular application. All it contains is the word module, followed by the name of my module, HelloWorld, and some curly…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.