How to install Bellsoft Liberica JDK 17 in Ubuntu 22.04 LTS with JAVA_HOME Environment Variable
In this video we are going to see How to install Bellsoft Liberica JDK 17 in Ubuntu 22.04 LTS for all users with JAVA_HOME Environment Variable and How to Compile and Run Java Module Program.
In this Example.
src --- contains two java modules CocktailShakerSort and CocktailShakerSortClient Modules. Each Module must contain module-info.java which is mandatory.
classes --- will store all the compiled class files of Java Modules.
Here CocktailShakerSort Module contains module-info.java which exports the com.javafrm package, so that other modules can access the package and com.javafrm package contains CocktailShakerSort.java and has one method.
Class name and Method should be public, then only you can access this class from other modules.
Next CocktailShakerSortClient Module contains contains module-info.java which requires (calls) CocktailShakerSort Module.
It contains org.javafrm package which contains CocktailShakerSortClient.java (Main class) and access the class and methods from CocktailShakerSort Module.
Example Java Commands:
javac --module CocktailShakerSortModule -d /opt/Java-Module-Programs/Modules/classes --module-source-path /opt/Java-Module-Programs/Modules/src
javac --module CocktailShakerSortClientModule -d /opt/Java-Module-Programs/Modules/classes --module-source-path /opt/Java-Module-Programs/Modules/src
java --module-path /opt/Java-Module-Programs/Modules/classes --module CocktailShakerSortClientModule/org.javafrm.CocktailShakerSortClient
#libericajdk #java #jdkinstallation #installjdk #installjava #javainstallation #javajdk #javalinux #javahome #ubuntu #jdk17