K
Karsten Wutzke
Hi all!
1. Is there any reliable way to tell whether the current program was
launched via JAR file or locally via the class files? I need to list
files in JAR directories in the former case, if not launched via JAR
file, I want to list files in local dirs via File.listFiles. ... which
brings me to issue #2...
2. How do I list files in JAR/ZIP directories?
I'd like to go the same way as resources do, e.g.
this.getClass().getResource(relativePath) shall (at best) create a URL
object that points to the JAR resource directory when launched via
JAR. When launched via class files, the URL resource to the local
directory should be returned. This looks like a trivial thing to me,
but it is getting more complicated than I thought, because there is no
simple way of listing files for URL's (a respective listFiles is
missing).
Any tips on how to best solve this quickly and painlessly?
TIA
Karsten
1. Is there any reliable way to tell whether the current program was
launched via JAR file or locally via the class files? I need to list
files in JAR directories in the former case, if not launched via JAR
file, I want to list files in local dirs via File.listFiles. ... which
brings me to issue #2...
2. How do I list files in JAR/ZIP directories?
I'd like to go the same way as resources do, e.g.
this.getClass().getResource(relativePath) shall (at best) create a URL
object that points to the JAR resource directory when launched via
JAR. When launched via class files, the URL resource to the local
directory should be returned. This looks like a trivial thing to me,
but it is getting more complicated than I thought, because there is no
simple way of listing files for URL's (a respective listFiles is
missing).
Any tips on how to best solve this quickly and painlessly?
TIA
Karsten