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.
1,591
questions
0
votes
0
answers
42
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" /&...
1
vote
1
answer
76
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 ...
0
votes
0
answers
30
views
Tomcat errors when upgrading Java from 1.8 to 1.9
I currently have an Apache Tomcat (9.0.43) server running on jre1.8.0_261. For various reasons, I'm trying to run the same code on jre-9.0.4. When I try this, I get the following error in Apache's ...
3
votes
1
answer
112
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 ...
0
votes
1
answer
50
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
│ ...
0
votes
1
answer
45
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 ...
0
votes
0
answers
56
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 ...
1
vote
1
answer
51
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 ...
0
votes
2
answers
139
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 = ...
0
votes
0
answers
45
views
Why is my java code here behaving this way where it returns true while it should return false? why if I remove the bool expression it still not work?
enter image description hereI included th image with the problem I have to solve;
I thought it should be easy. And expected my code to work. Yet it didn't...
I don't car a a lot about a solution as ...
3
votes
0
answers
55
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 ...
0
votes
0
answers
70
views
Formatting JVM GC logs
I am looking for a way to format logs in GC.
Currently, everything I already found is about adding or removing login content. I'm looking for a way to add my own log's tag at the beginning of the log ...
1
vote
2
answers
304
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....
-1
votes
1
answer
102
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("...
0
votes
1
answer
77
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 ...
0
votes
1
answer
46
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<...
5
votes
0
answers
168
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 ...
0
votes
0
answers
136
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 ...
1
vote
1
answer
127
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();
...
0
votes
1
answer
55
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 ...
0
votes
0
answers
24
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 ...
4
votes
1
answer
140
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 ...
0
votes
1
answer
75
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, ...
0
votes
0
answers
128
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 I can't renew my JAVA version (...
1
vote
0
answers
33
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 ...
0
votes
1
answer
75
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 "...
0
votes
0
answers
222
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 ...
0
votes
0
answers
88
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....
0
votes
1
answer
310
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 ...
0
votes
1
answer
111
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 ...
0
votes
0
answers
149
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 ...
0
votes
0
answers
51
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: ...
0
votes
0
answers
195
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 ...
5
votes
1
answer
239
views
Why do HashSets behave differently in Java 8 and Java 9+?
When trying to remove objects wrapped in iterator Java 8 and Java 9+ behave differently. Consider the following example:
import java.util.Date;
import java.util.HashSet;
import java.util.Iterator;
...
3
votes
1
answer
150
views
How to tell which module does the package belong to?
Given some package foo.bar, how do I find which module does it belong to?
For example, package java.util belongs to module java.base. I can verify it by typing in jdeps -m java.base and by going ...
1
vote
2
answers
352
views
How to depend on java validation api /hibernate modules in java with gradle as build tool?
I have similar question as here. However that question does not mention what build tool he is using and I assume that he is using maven as I didn't have problems with maven when using java 9 modules ...
3
votes
1
answer
149
views
Changed appearance of Swing TitledBorder since Java 9
I noticed a difference in the appearance of a TitledBorder between Java 8 (and earlier) and Java 9 (and later) on Windows with native look-and-feel. Starting with Java 9, the border is darker and ...
0
votes
1
answer
122
views
How to make Eclipse RUN patched JRE modules on JDK9+ with the —patch-module java option
This SO question asks how to get Eclipse to compile with the —patch-module javac option.
However, I have found no obvious and easy way to get Eclipse to run the compiled patched code using the same ...
0
votes
1
answer
517
views
Java 9 Modules VScode
I've been trying to work on Java 9's modules and I've been using VSCode to do so. I found no resource(webpage, YT video) or anything describing how the modules(Not JAR files) can be added to the build ...
1
vote
1
answer
75
views
replaceAll with lambda callback not working as expected
I'm a bit rusty with my Java-Fu, but I ran across an issue, which I don't quite get.
I have a string test\\"escape\"test\ that I'm trying to transform into test\"escape"test\ (this ...
0
votes
1
answer
127
views
Noname module issue with gradle dependency (Java 9)
I'm trying to port existing JavaFX app to Java 9.
Here's build.gradle
plugins {
id 'application'
id 'java'
id 'org.openjfx.javafxplugin' version '0.0.9'
}
repositories {
mavenLocal()
...
2
votes
3
answers
427
views
How to get every jvm setting/parameter from WITH IN running program?
Is there a way to get all the setting from which a java program (JVM) is running from with in the program. Yes, I want them from with in the program so I can log them as part of application log.
Here ...
0
votes
0
answers
38
views
how to use gradle build java library with module system?
how to use gradle build java library with module system ?
how to use gradle to do this:
build a jar with module-info.java
the jar can be use to both java8 and java9
2
votes
0
answers
347
views
Java as windows service with Apache Procrun and --add-module --add-opens --add-exports
We witched to Java11 and had to add
--add-module
--add-opens
--add-exports
as JVM parameters
The java program is running as a windows service via Apache Procrun.
Adding one of the above mentioned ...
3
votes
0
answers
74
views
Javadoc of package-private interface's methods is not inherited since Java 9
I have a public class that implements a package-private interface. I noticed that the javadoc of the interface's methods is no longer inherited since OpenJDK 9. I tested this with OpenJDK 9, 11, and ...
2
votes
1
answer
59
views
Getting the vendor of the used JRE since Java 9
Until 8, it was possible to get some information on the vendor of the used JRE as follows:
String vendor = Runtime.class.getPackage().getImplementationVendor().
Since Java 9 and the introduction of ...
0
votes
0
answers
113
views
How to open test package in module-info? Calling non-test class method in test class
I have Eclipse project in which i use Maven. I also use surefire plugin for tests. I wrote some test classes and tried to run mvn test, however i get this exception:
java.lang.reflect....
0
votes
1
answer
197
views
Read between two lines from a String in Java [closed]
I have a stream of text lines and I have to read a range from this string.
As an example, a given string:
str = "1 ddsfsdfs
d
6 s4. 3t
sdfdsfsfsf
dfdsfsfdfsdfd
345345
dsfsdf45v";
And I have ...
0
votes
1
answer
135
views
how to ceil and floor a Calendar Date by 10 minnutes?
there is a better way to round (ceil and floor) a date-time by ten minutes of the following code:
public void hintOfTime() {
Date orario = new SimpleDateFormat("hh:mm").parse(...
0
votes
1
answer
145
views
how to insert a date-time hh: mm into an array list sorted by times only if the time is 10 min before or after the insertion point
I have one question for my first development project in Java9.
I need to insert an Object with some info and a Date type, inside an ArrayList
only if the time is not present in the ArrayList and if it ...