improved/ added error messages

This commit is contained in:
fszimnau
2025-11-20 09:07:29 +01:00
parent 664c6108a5
commit 7df22a2d1f

View File

@@ -47,13 +47,16 @@ public class Main {
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
List<String> fileNames = new ArrayList<>();
URL jarUrl = classLoader.getResource("de/szimnau/zeitlaeufer");
if (jarUrl == null) {
throw new RuntimeException("Kann ausführbare Klassen nicht eruieren, da keine Ressource \"de/szimnau/zeitlaeufer\" verfügbar.");
}
String path = jarUrl.getPath().split(":", 2)[1];
String cleanPath = path.substring(0, path.lastIndexOf('!'));
Enumeration<JarEntry> entries;
try (var jarFile = new JarFile(URLDecoder.decode(cleanPath, StandardCharsets.UTF_8))) {
entries = jarFile.entries();
} catch (IOException e) {
throw new RuntimeException(e);
throw new RuntimeException("Kann JAR-Datei zwecks Reflection nicht öffnen:", e);
}
while (entries.hasMoreElements()) {
JarEntry entry = entries.nextElement();