EN
Is there way to configure Java 19 (or upper) in VS Code?
1 answers
5 points
As I noticed, VS Code supports currently Java 8, 11 and 19.
Is there way to configure Java 19 (or upper) in VS Code?

1 answer
7 points
Prerequirements: installed Java 19 on your computer (read this article).
Under Windows:
- press
Ctrl
+Shift
+P
keys,
- find and select Preferences: Open User Settings (JSON) option,
- add
"java.configuration.runtimes"
configuration,
e.g.:xxxxxxxxxx
1{
2// ...
3"java.configuration.runtimes": [
4{
5"name": "JavaSE-11",
6"path": "C:\\Program Files\\Eclipse Adoptium\\jdk-11.0.19.7-hotspot",
7},
8{
9"name": "JavaSE-17",
10"path": "C:\\Program Files\\Eclipse Adoptium\\jdk-17.0.8.101-hotspot",
11},
12{
13"name": "JavaSE-19",
14"path": "C:\\Program Files\\Eclipse Adoptium\\jdk-19.0.2.7-hotspot",
15"default": true
16}
17],
18// ...
19}
Note: you can use other JDK than Eclipse Adoptium.
Sometimes it may be needed to change Java version to 19 in pom.xml
file when you use Maven project.
e.g.:
xxxxxxxxxx
1
2
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3
4
<modelVersion>4.0.0</modelVersion>
5
6
<groupId>com.example</groupId>
7
<artifactId>my-project</artifactId>
8
9
<name>My project</name>
10
<description>My project description.</description>
11
<version>0.0.1-SNAPSHOT</version>
12
<packaging>jar</packaging>
13
14
<properties>
15
<java.version>19</java.version>
16
<maven.compiler.source>${java.version}</maven.compiler.source>
17
<maven.compiler.target>${java.version}</maven.compiler.target>
18
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
19
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
20
</properties>
21
22
<dependencies>
23
24
<!-- ... -->
25
26
</dependencies>
27
28
<build>
29
<finalName>${project.artifactId}</finalName>
30
<sourceDirectory>src</sourceDirectory>
31
<testSourceDirectory>test</testSourceDirectory>
32
<plugins>
33
<plugin>
34
<groupId>org.apache.maven.plugins</groupId>
35
<artifactId>maven-compiler-plugin</artifactId>
36
<version>3.7.0</version>
37
<configuration>
38
<source>${maven.compiler.source}</source>
39
<target>${maven.compiler.target}</target>
40
<verbose>true</verbose>
41
</configuration>
42
</plugin>
43
</plugins>
44
</build>
45
46
</project>
See also
0 commentsShow commentsAdd comment