Use this tag for questions specific to Java 18, which is version 18 of the Java platform, released on March 22, 2022. In most cases you should also specify the java tag.
Questions tagged [java-18]
26 questions
9
votes
4 answers
Java JDK 18 in IntelliJ prints question mark "?" when I tried to print unicode like "\u1699"
tldr: I downgraded to JDK 17 (17.0.2) and now it works...
I was watching a beginners Java tutorial by Kody Simpson on YT (youtube.com/watch?v=t9LP9Nt9Nco), and in that tutorial the boy Kody prints crazy symbols called Unicode like "☯Ωøᚙ", but for me…

Xin69
- 91
- 3
4
votes
1 answer
JPackage app-image exe launches multiple exe's in JDK 17+
The following small Java program and jpackage command create an app-image which when launched on Windows 10 launches multiple exe's. This does not happen before JDK 17. The same code and command using the JDK 16 jpackage results in only a single…

aauclair
- 41
- 1
4
votes
3 answers
Get response from external API in Spring Reactive WebFlux
Hi I'm new to reactive programming. I want to get a response from external API which has holiday calendar and count working days between given two days. Here is what I implement up to now. But I have no idea how to get holidays from…

Nisha
- 369
- 4
- 13
4
votes
1 answer
Java foreign function interface (FFI) interop with C++?
As of Java 18 the incubating foreign function interface doesn't appear to have a good way to handle C++ code. I am working on a project that requires bindings to C++ and I would like to know how to avoid creating a thunk library in C.
One of the C++…

gudenau
- 500
- 5
- 19
2
votes
1 answer
Java VarHandle to a C string with java.lang.foreign API
I would like to use foreign function interface from project panama to access C library from Java19. The C interface is quite simple:
typedef struct {
int len;
char name[100];
} ent;
ent* foo();
When called, function foo returns pointer to…

kofemann
- 4,217
- 1
- 34
- 39
2
votes
1 answer
i am not getting any error while not using main method in java 18 version
i am using Static block without using main method in java version "18.0.2" 2022-07-19 the code is perfectly working without any compile error and runtime error how is this possible?
class StaticBlockPrint{
static {
…

Mahipal bisht
- 21
- 2
2
votes
1 answer
Why should an application module not require a module that provides a service?
The ServiceLoader.java docs notes:
It is strongly recommended that the application module does not require modules which contain providers of the service.
Why is this strongly recommended, what could happen if the recommendation isn't…

Toast
- 93
- 1
- 6
2
votes
1 answer
how to call a C function from JDK 18 using jdk.incubator.foreign
This is similar to How to call a C function from Java 17 using JEP 412: Foreign Function & Memory API
but the API has changed in the move from JDK 17 -> 18.
Asking the question again: Does anybody have a simple example on how to call a C function…

effbiae
- 1,087
- 1
- 7
- 22
1
vote
1 answer
why does eclipse show an error message when using the javadoc tag @param when commenting?
I was typing some code in eclipse and as soon as I start to use the javadoc @param tag the IDE show me an error mark as seen in the picture. When I use the given solution from eclipse, the IDE corrects for example @param board to @paramboard but…

Heracless123
- 15
- 3
1
vote
1 answer
How to resolve scalac: Error: assertion failed:?
I'm pretty new to Scala programming. I pulled a code from GIT into IntelliJ. However, I'm getting the below error while compiling. I have installed latest Scala version (3.2.0) on to my mac (JDK18 is also installed).
scalac: Error: assertion failed:…

djm
- 45
- 6
1
vote
1 answer
LinkageError when trying to run Java-project in jdk 18.0.1.1
I have launched a project which was currently running in jdk 17.0.3, in the new jdk 18.0.1.1 and got the following error:
Fehler: Beim Laden der Klasse launching.Main ist ein LinkageError aufgetreten
java.lang.UnsupportedClassVersionError:…

xtay2
- 453
- 3
- 14
0
votes
1 answer
How to provide external file based code snippets using a Gradle Java project
I am trying to use code snippets using external file. My documentation looks like this:
/**
* The following method uses the {@code HttpRequest.GET()} method. Please use it like follows:
* {@snippet class="ShowHttpClientExamples"…

Shankha057
- 1,296
- 1
- 20
- 38
0
votes
0 answers
Can't see request from my controller service in Swagger UI
I know this question has been asked many times. However, I have not found the solution to my problem after many attempts.
I have a Java project (v17) using Spring, MongoDB and Swagger to allow services and exchanges between my front and…

KRdg
- 45
- 7
0
votes
0 answers
Why does taking a heap histo using OnOutOfMemoryError hang?
When the JVM (OpenJDK 18) throws an OutOfMemoryError, I want to make sure it stops and we take a heap histogram using jmap.
I achieve that with the flags -XX:-ExitOnOutOfMemoryError -XX:OnOutOfMemoryError=/usr/bin/jmap -histo:live $jpid && kill…

TTT
- 6,505
- 10
- 56
- 82
0
votes
0 answers
JavaFX 18 Maven IntelliJ: Graphics Device initialization failed for: d3d, sw Error initializing QuantumRenderer: no suitable pipeline found
I'd like to create a fat JAR (uber JAR), that runs on double click, and contains all dependencies (JavaFX and other). 'm using Java 18, JavaFX 18, Maven and IntelliJ for my project. The project builds succesfully, and by using the package command I…

Thend
- 95
- 7