Folgender Code wird nicht kompiliert.
(Compiler-Fehlermeldungen in Kommentaren zu problematischen Zeilen.)
Code: Select all
import java.io.IOException;
import java.nio.file.FileSystem;
import java.nio.file.FileSystems;
import java.nio.file.Path;
import java.nio.file.Paths;
import jdk.nio.zipfs.ZipFileSystem; // The type jdk.nio.zipfs.ZipFileSystem is not accessible
public class ZipFsTst {
public static void main(String[] args) {
Path path = Paths.get("C:", "Users", "USER", "Downloads", "jcalendar-1.4.jar");
try {
FileSystem fs = FileSystems.newFileSystem(path);
if (fs instanceof ZipFileSystem) { // ZipFileSystem cannot be resolved to a type
}
}
catch (IOException xIo) {
xIo.printStackTrace();
}
}
}
Code: Select all
file.encoding = UTF-8
file.separator = \
java.class.path =
java.class.version = 65.0
java.home = C:\Users\USER\eclipse\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_21.0.5.v20241023-1957\jre
java.io.tmpdir = C:\Users\USER\AppData\Local\Temp\
java.library.path = C:\Users\USER\eclipse\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_21.0.5.v20241023-1957\jre\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Users/user/eclipse//plugins/org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_21.0.5.v20241023-1957/jre/bin/server;C:/Users/USER/eclipse//plugins/org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_21.0.5.v20241023-1957/jre/bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Users\USER\AppData\Local\Microsoft\WindowsApps;;C:\Users\USER\eclipse;;.
java.runtime.name = OpenJDK Runtime Environment
java.runtime.version = 21.0.5+11-LTS
java.specification.name = Java Platform API Specification
java.specification.vendor = Oracle Corporation
java.specification.version = 21
java.vendor = Eclipse Adoptium
java.vendor.url = https://adoptium.net/
java.vendor.url.bug = https://github.com/adoptium/adoptium-support/issues
java.vendor.version = Temurin-21.0.5+11
java.version = 21.0.5
java.version.date = 2024-10-15
java.vm.compressedOopsMode = Zero based
java.vm.info = mixed mode, sharing
java.vm.name = OpenJDK 64-Bit Server VM
java.vm.specification.name = Java Virtual Machine Specification
java.vm.specification.vendor = Oracle Corporation
java.vm.specification.version = 21
java.vm.vendor = Eclipse Adoptium
java.vm.version = 21.0.5+11-LTS
jdk.debug = release
native.encoding = Cp1255
os.arch = amd64
os.name = Windows 11
os.version = 10.0
path.separator = ;
stderr.encoding = UTF-8
stdout.encoding = UTF-8
sun.arch.data.model = 64
sun.boot.library.path = C:\Users\USER\eclipse\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_21.0.5.v20241023-1957\jre\bin
sun.cpu.endian = little
sun.cpu.isalist = amd64
sun.io.unicode.encoding = UnicodeLittle
sun.java.launcher = SUN_STANDARD
sun.jnu.encoding = Cp1255
sun.management.compiler = HotSpot 64-Bit Tiered Compilers
sun.os.patch.level =
Code: Select all
module-info.java
Code: Select all
module jartoolm {
requires jdk.zipfs;
}

Was habe ich übersehen?