Where to place module-info.java using Java 9?

I have an OSGI application and I have around 30 bundles (jar files). Today I decided to see how it works/if it works with Java 9. So I started my application and got WARNING: An illegal reflective access operation has occurred WARNING: Illegal refl...
more »

2017-09-05 20:09 (3) Answers

Java 9, Set.of() and Map.of() varargs overloads

So I'm studying the factory methods for Immutable collections. I see the Set.of() method has 10 varargs overloading (same for Map.of()). I really can't understand why there are so many. In the end the function ImmutableCollections.SetN<>(elem...
more »

2017-08-02 09:08 (3) Answers

"Source not found" when clicking on stacktrace

Usually, clicking on a line in the stacktrace, the source file opens at the offending line. With Eclipse-oxygen (R with support for java9 installed) and java9 (u175) it shows a dialog "Source not found" if the source is somewhere inside the java modu...
more »

2017-07-31 12:07 (1) Answers

Deep reflection fails in xxSkin classes

Since update 9-u175, java permits illegal access by default thus allowing all the old reflection tricks. Works fine, except when it comes to classes in control.skin (maybe others as well, didn't check) - to reproduce, run the example below, click the...
more »

2017-07-28 11:07 (1) Answers

ImmutableCollections SetN implementation detail

I have sort of a hard time understanding an implementation detail from java-9 ImmutableCollections.SetN; specifically why is there a need to increase the inner array twice. Suppose you do this: Set.of(1,2,3,4) // 4 elements, but internal array is 8...
more »

2017-07-27 15:07 (1) Answers

Why is exporting the entire module not allowed?

In Java 9's module declaration there are 2 constructs: exports com.foo; And opens com.foo; Where exports grants compile-time access, while opening allows runtime access, as reflection and resources. Opening has one leniency over exporting tha...
more »

2017-07-23 22:07 (1) Answers

JDK9 randomization on immutable sets and maps

Reading this question and the answer given by Eugene, I found that JDK9 immutable sets and maps will introduce a source of randomness that will affect their traversal. This means that iteration order will indeed be random, at least among different ru...
more »

2017-07-20 20:07 (2) Answers

Why does Map.of not allow null keys and values?

With Java 9, new factory methods have been introduced for the List, Set and Map interfaces. These methods allow quickly instantiating a Map object with values in one line. Now, if we consider: Map<Integer, String> map1 = new HashMap<Intege...
more »

2017-07-20 11:07 (7) Answers

Loading classes and resources in Java 9

I was reading this article on InfoQ quoting Reinhold: Developers can still use the Java class path in Java 9 for the Java runtime to search for classes and resource files. It's just that with Java 9's modules, developers no longer need the cl...
more »

2017-07-18 14:07 (1) Answers

Keystore does not work on Java 9

I've converted a JKS keystore to the P12 format using portecle, but it probably didn't go well. The keystore works with Java 8 (various versions), but with Java 9 (OpenJDK 64-Bit Server VM (build 9-internal+0-2016-04-14-195246.buildd.src, mixed mode)...
more »

2017-07-11 19:07 (1) Answers

How to execute a java script with jshell?

Given that Java 9 is upon us and we can finally have a java REPL with jshell I was hoping there was a way to add a shebang to a script and have jshell interpret it. I tried creating test.jsh: #!/usr/bin/env jshell -s System.out.println("Hello World...
more »

2017-07-05 05:07 (2) Answers

Java 9 Zip End Header Not Found Exception

I am trying to batch download zip files from this URL using java - SRTM files and it requires a username/password to download and I am using the following java code and it gives me the following exception java.util.zip.ZipException: zip END header ...
more »

2017-07-04 09:07 (1) Answers

Unable to start solr with Java 9

I am unable to start solr on Java 9, getting following error. [shahid@host172 logs]$ tail -20 solr-8983-console.log Java HotSpot(TM) 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a f...
more »

2017-07-03 08:07 (1) Answers

Java 9: Exporting packages to unnamed modules fail

I am trying to build an open-source project against Java 9. There are some files which I need to access using reflection but I cannot because the packages are not exported by their modules. I export the packages to unnamed modules by using the argume...
more »

2017-06-26 11:06 (2) Answers

Why did Java 9 introduce the JMOD file format?

Java 9 has three ways to package compiled code in files: JAR JMOD JIMAGE JIMAGE is optimized for speed and space and used by the JVM at runtime so it makes sense why JIMAGE was introduced. JIMAGE files are not supposed to be published to maven r...
more »

2017-06-24 06:06 (1) Answers

How to resolve module reads package error in java9

I am trying to understand new modularity in java 9 with spring-boot so I want to run some simple application for example: https://github.com/tmatyashovsky/java9-springboot I am using maven 3.5.0 with java 9: Apache Maven 3.5.0 (ff8f5e7444045639af65...
more »

2017-06-22 13:06 (0) Answers