Skip to content
Yash edited this page Sep 11, 2017 · 23 revisions

Welcome to the LearnJava wiki!

Exploring Java 9 by Venkat Subramaniam

JDK 9 « http://openjdk.java.net/projects/jdk9/ JDK 9 Early Access Release Notes « http://jdk.java.net/9/release-notes

Module System

  • Java SE and the JDK have been significantly updated by the introduction of the Java Platform Module System (JSR 376) and using the module system to modularize the Java SE Platform and the JDK.

Image Link « https://bugs.openjdk.java.net/secure/attachment/57772/jdk.png

Errors Images - https://bugs.openjdk.java.net/images/errors.png

A modeule is a collection of code (packages) and data.

Java < 9 : Class path
	java -cp
	
Java 9 : Module Path
	java -mp
	
jar -c -f myModule.jar --main-class com.*.MyClass

// https://youtu.be/8XmYT89fBKg?t=3319
com.java.module1;

Class supportedClass {
	MyIn getInstance(... []) {
		retutn new MyInterfaceImple();
	}
}
Interface MyIn {
	add(a, b);
}

com.java.module1.sub;
MyInterfaceImple impl MyIn {
add(a, b) {
	return a+b;
}
}

careating a modlue so that iam allowing only module1 access to client not module1.sub

module com.java {
	require java.base; // default added by the compailer
	export 	com.java.module1;
}

clientMain() {
mainFn() {
 MyIn ins = getInstance();
 
 he canot use .sub packege here restircted to allowing access.
}
}

transfer readability « https://youtu.be/8XmYT89fBKg?t=4089

Clone this wiki locally