Observer is deprecated in Java 9. What should we use instead of it?

Why is that? Does it mean that we shouldn’t implement observer pattern anymore? Answering the latter part first – YES, it does mean you shouldn’t implement Observer and Obervables anymore. Why were they deprecated – They didn’t provide a rich enough event model for applications. For example, they could support only the notion that something … Read more

Java 9, compatability issue with ClassLoader.getSystemClassLoader

You’ve run into the fact that the system class loader is no longer a URLClassLoader. As indicated by ClassLoader::getSystemClassLoader‘s return type, this was an implementation detail, albeit one that a non-negligible amount of code relied upon. Judging by the comments, you are looking for a way to dynamically load classes at run time. As Alan … Read more

Scanning classpath/modulepath in runtime in Java 9

The following code achieves module path scanning in Java 9+ (Jigsaw / JPMS). It finds all classes on the callstack, then for each class reference, calls classRef.getModule().getLayer().getConfiguration().modules(), which returns a a List<ResolvedModule>, rather than just a List<Module>. (ResolvedModule gives you access to the module resources, whereas Module does not.) Given a ResolvedModule reference for each … Read more

How to express dependency in maven on java ee features for transition to Java 9?

The Module System speaks of the way the unnamed modules as in your case of loading the application from classpath constructs the module graph. Further, from the documentation itself:- When the compiler compiles code in the unnamed module, or the java launcher is invoked and the main class of the application is loaded from the … Read more

Java Web Start support in Java 9 and beyond

According to http://www.oracle.com/technetwork/java/javase/9-deprecated-features-3745636.html Java Deployment Technologies are deprecated and will be removed in a future release Java Applet and WebStart functionality, including the Applet API, The Java plug-in, the Java Applet Viewer, JNLP and Java Web Start including the javaws tool are all deprecated in JDK 9 and will be removed in a future release. … Read more