---
type: archive
area: archive
status: archived
date: 2026-05-03
created: 2026-05-03
updated: 1980-01-01
tags:
  - archive
---
- If we use Manifest.MF file we don't need to specify the main class when running jar fil from cli
### Benefits of modules:
- Visibility is controlled by access modifiers
- 
## Modular Java
- Class.forname("a class  name") this loaded a class into memory
- Module is a high-level code aggregation.
- Module name should be **universally unique** 

![[img-20240817-172627-a69cad1a.png]]

- exports parts of which package that are made available to other who will use this module
- By default all packages are unavailable for external use
- we should define which one to use explicitly
- opens allow the use the packages including accessing via reflections.

![[img-20240817-174451-5e9027e2.png]]

- requires transitive means that who will use **com.some** will get transitive module explicitly .
- static means that the application can run without this module (Optional) validated at compile time.
- When we export packages all classes that made public or protect are made available for the application that uses this module (we can export some packages to only some defined module)
- Opens open some packages or all of them to external use without using requires directive '(incl all nonpublic types available via reflection). 

### Opens and services:
- In open the same we can specify the modules which to open or to every one
- Same as export but opens all non-public types via reflection.
- When using opened Modules we don't need requires 
- We can open an entire module
- Services rules:
	- we need 3 modules
		- Service (That provide a service)
		- Provider (that implements the service)
		- Consumer  (That uses this "Service Impl"  Provider)
- In Services we need a Module that contains an (interface or an abstract class) that plays the role of service after we have a Consumer that consume the provided service but indirectly by using (or consuming an implementation of that service) by the Provider
- in module-info of Consumer we never find any indication about Provider on what interface uses from the service.
##### Example
![[img-20240818-233153-f104fc13.png]]

### Jlink:
- jlink we can create custom runtime image for any specific os.
- Jdeps list list pf java dependencies.
- 