improved/ added error messages
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user