Java 9 Module System and Control Panel

Last updated on Dec 25 2022
Prabhas Ramanathan

Java Module System is a major change in Java 9 version. Java added this feature to collect Java packages and code into a single unit called module.
In earlier versions of Java, there was no concept of module to create modular Java applications, that why size of application increased and difficult to move around. Even JDK itself was too heavy in size, in Java 8, rt.jar file size is around 64MB.
To deal with situation, Java 9 restructured JDK into set of modules so that we can use only required module for our project.
Apart from JDK, Java also allows us to create our own modules so that we can develop module based application.
The module system includes various tools and options that are given below.
• Includes various options to the Java tools javac, jlink and java where we can specify module paths that locates to the location of module.
• Modular JAR file is introduced. This JAR contains module-info.class file in its root folder.
• JMOD format is introduced, which is a packaging format similar to JAR except it can include native code and configuration files.
• The JDK and JRE both are reconstructed to accommodate modules. It improves performance, security and maintainability.
• Java defines a new URI scheme for naming modules, classes and resources.

Table of Contents

Java 9 Modularized JDK

java 73

 

Java 9 Module

Module is a collection of Java programs or softwares. To describe a module, a Java file module-info.java is required. This file also known as module descriptor and defines the following
• Module name
• What does it export
• What does it require

java 74

Module Name

It is a name of module and should follow the reverse-domain-pattern. Like we name packages, e.g. com.tecklearn.

How to create Java module

Creating Java module required the following steps.
• Create a directory structure
• Create a module declarator
• Java source code

Create a Directory Structure

To create module, it is recommended to follow given directory structure, it is same as reverse-domain-pattern, we do to create packages / project-structure in Java.
Note: The name of the directory containing a module’s sources should be equal to the name of the module, e.g. com.tecklearn.
Create a file module-info.java, inside this file, declare a module by using module identifier and provide module name same as the directory name that contains it. In our case, our directory name is com.tecklearn.

1. module com.tecklearn{ 
2. 
3. }

Leave module body empty, if it does not has any module dependency. Save this file inside src/com.tecklearn with module-info.java name.

Java Source Code

Now, create a Java file to compile and execute module. In our example, we have a Hello.java file that contains the following code.

1. class Hello{ 
2. public static void main(String[] args){ 
3. System.out.println("Hello from the Java module"); 
4. } 
5. }

Save this file inside src/com.tecklearn/com/tecklearn/ with Hello.java name.

Compile Java Module

To compile the module use the following command.
1. javac -d mods –module-source-path src/ –module com.tecklearn
After compiling, it will create a new directory.
Now, we have a compiled module that can be just run.

Run Module

To run the compiled module, use the following command.
1. java –module-path mods/ –module com.tecklearn/com.tecklearn.Hello
Output:
Hello from the Java module
Well, we have successfully created, compiled and executed Java module.

Look inside compiled Module Descriptor

To see the compiled module descriptor use the following command.
1. javap mods/com.tecklearn/module-info.class
This command will show the following code to the console.

1. Compiled from "module-info.java" 
2. module com.tecklearn { 
3. requires java.base; 
4. }

See, we created an empty module but it contains a java.base module. Why? Because all Java modules are linked to java.base module and it is default module.

Java 9 Control Panel

Java control panel is used to control Java applications that are embedded in browser. This control panel maintains the settings that manage Java application embedded in browser.
In Java 9, control panel was rewritten as a JavaFX application and the storage location has changed. To start control panel, enter jcontrol to the terminal (cmd for windows) and it will open a window that looks below.

java 75

It contains the following tabs :

General

This tab shows version details and security status of JRE Java runtime (JRE) that we are running.

Update

This tab shows when the check for updates is done and enables us to change the settings for the update process.

Desktop Settings

This tab shows information about the JREs that are installed on our system and enables us to choose the JREs that we want to use to run applications that are embedded in a web page or launched from a browser.

Web Settings

This tab shows information about permissions for Java applications and how the applications connect to the network. It also allows us to manage temporary files.
The Web Settings tab further contains the following tabs.
• Exception Site List Tab
• Deployment Rule Set Tab
• Temporary Files Settings Tab
• Network Settings Tab
• Java Cache Viewer Tab

java 76

Security

It shows general security settings and information about certificates used to sign RIAs.
The Security tab further contains the following tabs.
• General Security Settings Tab
• Manage Certificates Tab

Advanced

It allows us to set options for available JRE. JRE has following options.
• Debugging
• Java Console
• Shortcut Creation
• JNLP File/MIME Association
• Application Installation
• Execution Environment Security Settings
• Mixed code (sandboxed vs. trusted) security verification
• Perform signed code certificate revocation checks on
• Check for signed code certificate revocation using
• Advanced Security Settings

Miscellaneous

So, this brings us to the end of blog. This Tecklearn ‘Java 9 Module System and Control Panel’ blog helps you with commonly asked questions if you are looking out for a job in Java Programming. If you wish to learn Java and build a career Java Programming domain, then check out our interactive, Java and JEE Training, that comes with 24*7 support to guide you throughout your learning period. Please find the link for course details:

Java and JEE Training

Java and JEE Training

About the Course

Java and JEE Certification Training is designed by professionals as per the industrial requirements and demands. This training encompasses comprehensive knowledge on basic and advanced concepts of core Java & J2EE along with popular frameworks like Hibernate, Spring & SOA. In this course, you will gain expertise in concepts like Java Array, Java OOPs, Java Function, Java Loops, Java Collections, Java Thread, Java Servlet, and Web Services using industry use-cases and this will help you to become a certified Java expert.

Why Should you take Java and JEE Training?

• Java developers are in great demand in the job market. With average pay going between $90,000/- to $120,000/- depending on your experience and the employers.
• Used by more than 10 Million developers worldwide to develop applications for 15 Billion devices.
• Java is one of the most popular programming languages in the software world. Rated #1 in TIOBE Popular programming languages index (15th Consecutive Year)

What you will Learn in this Course?

Introduction to Java

• Java Fundamentals
• Introduction to Java Basics
• Features of Java
• Various components of Java language
• Benefits of Java over other programming languages
• Key Benefits of Java

Installation and IDE’s for Java Programming Language

• Installation of Java
• Setting up of Eclipse IDE
• Components of Java Program
• Editors and IDEs used for Java Programming
• Writing a Simple Java Program

Data Handling and Functions

• Data types, Operations, Compilation process, Class files, Loops, Conditions
• Using Loop Constructs
• Arrays- Single Dimensional and Multi-Dimensional
• Functions
• Functions with Arguments

OOPS in Java: Concept of Object Orientation

• Object Oriented Programming in Java
• Implement classes and objects in Java
• Create Class Constructors
• Overload Constructors
• Inheritance
• Inherit Classes and create sub-classes
• Implement abstract classes and methods
• Use static keyword
• Implement Interfaces and use it

Polymorphism, Packages and String Handling

• Concept of Static and Run time Polymorphism
• Function Overloading
• String Handling –String Class
• Java Packages

Exception Handling and Multi-Threading

• Exception handling
• Various Types of Exception Handling
• Introduction to multi-threading in Java
• Extending the thread class
• Synchronizing the thread

File Handling in Java

• Input Output Streams
• Java.io Package
• File Handling in Java

Java Collections

. Wrapper Classes and Inner Classes: Integer, Character, Boolean, Float etc
• Applet Programs: How to write UI programs with Applet, Java.lang, Java.io, Java.util
• Collections: ArrayList, Vector, HashSet, TreeSet, HashMap, HashTable

Java Database Connectivity (JDBC)

• Introduction to SQL: Connect, Insert, Update, Delete, Select
• Introduction to JDBC and Architecture of JDBC
• Insert/Update/Delete/Select Operations using JDBC
• Batch Processing Transaction
• Management: Commit and Rollback

Java Enterprise Edition – Servlets

• Introduction to J2EE
• Client Server architecture
• URL, Port Number, Request, Response
• Need for servlets
• Servlet fundamentals
• Setting up a web project in Eclipse
• Configuring and running the web app with servlets
• GET and POST request in web application with demo
• Servlet lifecycle
• Servlets Continued
• Session tracking and filter
• Forward and include Servlet request dispatchers

Java Server Pages (JSP)

• Fundamentals of Java Server Page
• Writing a code using JSP
• The architecture of JSP
• JSP Continued
• JSP elements: Scriptlets, expressions, declaration
• JSP standard actions
• JSP directives
• Introduction to JavaBeans
• ServletConfig and ServletContext
• Servlet Chaining
• Cookies Management
• Session Management

Hibernate

• Introduction to Hibernate
• Introduction to ORM
• ORM features
• Hibernate as an ORM framework
• Hibernate features
• Setting up a project with Hibernate framework
• Basic APIs needed to do CRUD operations with Hibernate
• Hibernate Architecture

POJO (Plain Old Java Object)

• POJO (Plain Old Java Object)
• Persistent Objects
• Lifecycle of Persistent Object

Spring

• Introduction to Spring
• Spring Fundamentals
• Advanced Spring

Got a question for us? Please mention it in the comments section and we will get back to you.

 

 

0 responses on "Java 9 Module System and Control Panel"

Leave a Message

Your email address will not be published. Required fields are marked *