Questions tagged [java-9]

Use this tag for questions specific to Java 9, which is version 9 of the Java platform, released on the 21st of September 2017. In most cases you should also specify the java tag.

Filter by
Sorted by
Tagged with
0 votes
0 answers
43 views

Java 9 Modules & IntelliJ: how to configure multiple modules

I am trying to create a very simple java modules project in IntelliJ with multiple modules. Accordingly documentation in https://openjdk.org/projects/jigsaw/quick-start#multimodulecompile inside src ...
mpssantos's user avatar
  • 941
2 votes
1 answer
101 views

Error message mentions Java 9 even though I am using Java 11

I have a Java 11 Gradle project for work. I am using IntelliJ Idea. I have some test errors, so I'm trying to debug. The error message I'm asking about appears to be unrelated to the test errors, but ...
apex2022's user avatar
  • 777
0 votes
0 answers
48 views

Are there any solutions available that would eliminate the need to add `jvm` options when using Java 9 modules?

I am new to using Java 9 modules. I am aware that there are different types of Java 9 modules such as Automatic modules and Unnamed modules. I am curious why I am able to use third-party dependencies ...
fade's user avatar
  • 1
0 votes
0 answers
218 views

Mockito cannot mock this class - Caused by: NoClassDefFoundError: sun/misc/ObjectInputFilter$FilterInfo

While executing JUnits with OpenJdk-11, Mockito-3.12.4 and powermock-2.0.9 getting below error. Also, I am using third party library (pcm.jar) which is compiled by Java 1.8. Error is - ...
Chowdappa's user avatar
  • 1,580
0 votes
1 answer
100 views

Java9 'asIterator' equivalent implementation in Java8 [duplicate]

Below piece of code is using asIterator() method from Java 9 can someone please help me to convert below code compatible with Java 8? private static Function<ClassLoader, Stream<URL>> ...
Swapnil Kotwal's user avatar
1 vote
0 answers
35 views

Is android system support multi-release jar?

I included a multi-release jar into app.libs and call the api in the jar(the api simply print current jdk version). But it didn't work. Will multi-release jar work in android? How to make it work?
黄柯睿's user avatar
0 votes
0 answers
58 views

Vaadin 14, production build and java version 9 not working

I need some of features of java 9 and I have vaadin 14 app. When I changed java.version in the pom.xml to the java version 9, app. is not running in Tomcat server (production build). Tomcat only show ...
ZZerog's user avatar
  • 1
0 votes
0 answers
63 views

Java module system: how to avoid leaking all packages of transitive modules

In java module system, we can have: module hellomodule { exports com.name.hello; requires transitive greetings; } by doing this the packages exposed by greetings module will effectively ...
GionJh's user avatar
  • 2,794
0 votes
1 answer
171 views

Cannot access 'java.lang.Object' error with new Android Studio Electric Eel

I just installed the new Electric Eel Android Studio stable version, but I am getting the following error messages below although the project builds without errors. The errors are happening in the ...
Raj Narayanan's user avatar
3 votes
0 answers
72 views

Distinguish empty Stream, Stream of empty Optionals only, Stream with at least one non-empty Optional [duplicate]

I have a Stream<Optional<T>>. I want to use the findFirst()/findAny() methods to return a value. However I want to throw different exceptions depending on the Stream being empty or not. ...
Urben's user avatar
  • 65
2 votes
0 answers
53 views

How to configure java 9 module with many shared java 8 dependencies?

I have a project where dependencies were designed based on java 8, I'm using java 9 modules. I keep getting errors related to multiple exports. java: java.lang.reflect.InvocationTargetException ...
Borel's user avatar
  • 29
2 votes
1 answer
92 views

Issue with Stream processing when migrating from Java 8 to 9 [duplicate]

The below code compiled with Java 8 works as expected but doesn't work with Java 9. Not sure what changed in the Streams execution. import java.util.*; import java.util.function.Predicate; import java....
Kartik's user avatar
  • 83
1 vote
0 answers
85 views

Modularity for spring boot multi module

I have Spring boot multi module micro service application like below parent module -childmodule1 -childmodule2 -childmodule3 Currently each child modules are depolyed as single jar. I need to ...
Kiran 's user avatar
  • 11
2 votes
0 answers
144 views

Why does the java.util.Objects.checkIndex method need @ForceInline?

Java version: openjdk-18.0.2.1 @ForceInline public static int checkIndex(int index, int length) { return Preconditions.checkIndex(index, length, null); } I'm not sure why the class java.util....
YoungJun Park's user avatar
0 votes
1 answer
321 views

In NetBeans Java, how do you create a multi-module project?

I want to create a multi-module Java project, in NetBeans 15. By "module", I mean the Java-9 "modularity" feature, where each module folder has a module-info.java file that ...
Daniel Cohen's user avatar
1 vote
1 answer
441 views

Is there some method to get all class name under some package of JRE's system module(Java9+),for example java.base

I refer to this article (https://www.baeldung.com/java-find-all-classes-in-package), under Java11: work only to the package like "com.xxx", if i test "java.util", not work(return 0 ...
zhan yongqiang's user avatar
-5 votes
1 answer
215 views

How to convert a given string to an immutable list of characters in java? [Updated] [closed]

I am looking for a solution to convert a given string for example: “helloworld” to a list of characters which should be immutable in nature. What I already tried is using StreamApi 'Stream.collect(...
iamgirdhar's user avatar
  • 1,127
1 vote
1 answer
2k views

IntelliJ IDEA - can't find module-info.java file

I am following a course where I need to create a module-info.java file but I can't find it on new. I started om jdk11 but also downloaded jdk9 but still can't find it. Would greatly appreciate if ...
idan daniel's user avatar
1 vote
0 answers
202 views

How to create a runnable Jar file using Jigsaw modules

I try to learn about the modules introduced in java 9. I try to create a runnable Jar. I have the main module, which I want to run and one dependendency module, helloWorldModule. Module: mainModule ...
M. Lee's user avatar
  • 87
1 vote
1 answer
97 views

How does requires transitive work in Java?

Can com.demo.invoice access com.demo.product.service? module com.demo.product { exports com.demo.product.service to com.demo.order; } module com.demo.order { exports com.demo.order....
Tanisha Sethi's user avatar
0 votes
0 answers
131 views

Using modern Java HTTP client to Tomcat 9; cannot get HTTPS to work though self-signed certs in place [duplicate]

Tomcat configured for both 8080 and 8443: <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /&...
Russ Bateman's user avatar
  • 18.4k
3 votes
1 answer
997 views

Does the jmods directory in jdk/jmods have any role during application runtime?

I have an application which runs in a sandbox environment using an OpenJDK. The JDK directory has a jmods folder. The documentation regarding jmods isn't that great. From what I understand, jmods is ...
Tanmay Majumdar's user avatar
3 votes
1 answer
260 views

What is considered as Java core module?

I'm reading through JDK9 release notes and found a small lack of information. In one of the paragraphs, there is written: The classes in many non-core modules are now defined to the platform class ...
Petr Štechmüller's user avatar
1 vote
1 answer
307 views

How to config IDEA to support Multi-Release Jar development

I am learning MRJar and trying to create a sample example which has folder structure as follow, both java folder and java9 folder are marked as source root └───main ├───java │ └───com │ ...
askaquestion's user avatar
0 votes
1 answer
152 views

Java jar manifest file with unrecognized fields

I am working on migration my application to java9, I found that I can set Add-Opens in my manifest file to open some java internal packages for reflection usage. I am thinking fields like Add-Opens ...
askaquestion's user avatar
0 votes
0 answers
67 views

How to get service of concrete Module in JPMS?

I have a dynamically created layer that has about 25 modules. About 7-10 modules can provide com.foo.Bar service. I need to get a service of concrete module - I have a reference to Module. Could ...
Pavel_K's user avatar
  • 11.1k
1 vote
1 answer
81 views

Use encapsulated module in non modular Servlet based web app

I have an existing Java web app based on Servlets. It's an Eclipse project and it runs in Tomcat 10. The application doesn't use any Java 9+ modularization / JPMS up to now. The code base started at ...
MrSnrub's user avatar
  • 1,133
0 votes
2 answers
809 views

Cannot convert from Stream<T> to boolean

I'm trying to filter a list of objects say BOLReference based on a key which is present in the inner object of one of the List of Objects of this BOLReference. List<BOLReference> bolRef = ...
Mira Devi's user avatar
3 votes
0 answers
112 views

Change in regex canonical equivalence matching between java 8 and 9

I have a big regex matching excel like coordinates in a text, which should ignore ranges. I noticed a change in behavior when updating java version. I simplified the regex and the code. Here is the ...
Rudy's user avatar
  • 31
1 vote
2 answers
2k views

Observer and Observable got deprecated and the reason stated is: they convey something has changed but not state what has changed, this is false?

Check this by open jdk deprecate Observer and Observable Observer and Observable Class: Observable:- class NewsAgency extends Observable { String news; public void setNews(String news) { this....
N-RAYAN's user avatar
  • 133
-1 votes
1 answer
396 views

Java Enum Deserialization without class model getting null value

I have an Enum class like below. I need to de serialize a Json string(With Key Value pair Format) to the below Enum Object very efficiently in Java8 or above. public enum TestEnum { RED("...
JAMBUGOLA MAHESH's user avatar
0 votes
1 answer
353 views

Make java.sql package or module available to boot classloader

I am using sql statement wrappers. When trying with jdk 11, I am getting java.lang.NoClassDefFoundError: java/sql/PreparedStatement. From java 9, java.sql is loaded in the platform loader. My wrapper ...
Amarnath Reddy's user avatar
0 votes
1 answer
49 views

How do I avoid reaching the .or() in this code?

static final Function<Bill,Optional<LocalDate>> toDateOfInjury = b -> toClaim.andThen(opt -> opt.map(Claim::getDatInjuryDate)).apply(b); public static final Supplier<Optional<...
FaraBara's user avatar
  • 115
4 votes
0 answers
416 views

How to use one ResourceBundleProvider for all resource bundles in all Modules?

I am developing a multi-module Java application. Each module contains several resource bundles: when a class Demo.java requires translations, a resource bundle Demo.properties in the same package is ...
kske's user avatar
  • 138
0 votes
0 answers
377 views

How secure is module-info.java?

I'm just thinking how secure is the module-info.java , for example lets say if the library provider has added some restriction and opens only few service classes for the consumers. I believe the ...
Abdul Mohsin's user avatar
1 vote
1 answer
446 views

Java9 modules : How to execute Provider based on some priority of execution?

I am using java 9 modules to implement provider , i have multiple providers for service interface. I want to provide some priority for providers for their execution insted of using findFirst(); ...
Akhilesh Pandey's user avatar
0 votes
1 answer
111 views

How to make Eclipse autocomplete JShell methods?

I am trying to write a snippet of code using JShell programmatically in Eclipse, but Eclipse filters all members of jdk.jshell.JShell class in autocomplete. I see only members inherited from Object ...
Michał Grzejszczak's user avatar
0 votes
0 answers
32 views

gfe.jar SDLParser from java 1.6 to java 11

Hy, I've ported an old 1.6 java desktop application to java 11, a lot of problems concerning jaxb no more supported on jre but at the end the application is running. Actually I've a problem with a jar ...
Etantonio's user avatar
  • 359
4 votes
1 answer
321 views

How to add resources to two modular jars in same-named folders?

Assuming we have two jar files with two different modules. Both jar-files include some resources (lets say png-files) in a folder called images in their jar. When I now try to start a module in java I ...
Zach's user avatar
  • 81
0 votes
1 answer
311 views

Running Java module from command line breaks when I reverse argument order

I can run a Java module from the command line without issues as follows: java -p "dir/with/module1;dir/with/module2" -m my.module.name //runs fine However, when I reverse the arguments, ...
JellyRaptor's user avatar
0 votes
0 answers
230 views

How to use NASA's panoply on Windows system?

I want to use Panoply on my computer (Windows 10). The packages I downloaded from this website said that it requires JAVA 9 (or later version) to install Panoply. But my JAVA version (JAVA 8) on my ...
Jaden Tseng's user avatar
1 vote
0 answers
34 views

Java9 module error only in Eclipse (not IntelliJ/Gradle) [duplicate]

I am getting a The package javax.xml.namespace is accessible from more than one module: <unnamed>, java.xml when trying to upgrade an app from Java8 -> 11. The error, as well as potential ...
andywarren86's user avatar
2 votes
1 answer
183 views

Why does getClass().getName() work on a module class that is not open?

I have two Java 9 modules, a server, and a handler. The server loads HTTP handlers with the ServiceLoader (code below). Why does the o.getClass().getName() in this snippet work? Is it because ...
user1789168's user avatar
0 votes
0 answers
435 views

Modularity issues with javaagent in Java 9

We have a javaagent written in Java 8 that instruments application code using javassist. There is one simple ClassFileTransformer that instruments java.lang.Error class constructor to record an ...
Srinivas's user avatar
0 votes
0 answers
202 views

CompletedStage.completedFuture VS CompletedStage.completedStage

I saw since Java9 CompletedStage.completedStage() is almost equals to CompletedStage.ompletedFuture() When we must return CompletionStage<Void> we can return both. CompletedFuture....
cyril's user avatar
  • 892
0 votes
1 answer
548 views

Converting Flux<Object> returned from DB to Mono<List<Dto>>

My DB is returning Flux I need to convert it to Mono<List> of DTO and return it to caller method. My Fruit class already has a builder method to convert Fruit to FruitDto. If the return type of ...
Puneet's user avatar
  • 13
0 votes
1 answer
193 views

Stream groupBy to nested maps with casting

Need to calculate total number by gender from below structure of nested Maps. But as data stored as Object need to cast it at every iteration. After grouping not able to cast last leaf Map to ...
Sheel's user avatar
  • 1,020
0 votes
0 answers
287 views

Using java.lang.ref.Cleaner in Android project

I am working on an Android project. My setup: Host development machine: Macbook Android studio Arctic Fox, 2020.3.1 Android Gradle Plugin Version 7.0.0 Gradle Version 7.0.2 JDK 11 located under ...
DwayneDuane's user avatar
0 votes
0 answers
156 views

IBM i command prompting in JTOpen not working with Java 9 and above

Having compiled my JTOpen application with java 16, I bumped into the following error in the JTOpen command prompter: Exception in thread "AWT-EventQueue-0" java.lang.IllegalAccessError: ...
Lenny's user avatar
  • 1
0 votes
1 answer
399 views

Cannot build executable jar using maven-jar-plugin when migrating to java 9 modules

I am introducing java 9 modules to a big project and I am facing an issue when trying to build an executable JAR (on one of the sub module) using the maven-jar-plugin. Here is a small view of my ...
Mr. D's user avatar
  • 667

1
2 3 4 5
33