J
Jason Cavett
I am having trouble accessing files located in a JAR. Here's my
current setup (names have been changed of the JAR files).
JAR1.jar - This is the JAR that will try to access the text.properties
file. (This is a library that is being used by JAR2.jar)
JAR2.jar
- path/to/text.properties (this is the file I'm trying to access)
Here is the code I'm using to access the file.
URL propertiesUrl = ClassLoader.getSystemResource(DEFAULT_PATH +
FILE);
This works when I'm within Eclipse (most likely because the file is
not in a JAR from what I can tell.) However, as soon as I package up
the files into their respective JARs using ANT and I try to run the
executable jar (JAR2), I receive an error...
Exception in thread "main" java.lang.ExceptionInInitializerError
Caused by: java.lang.IllegalArgumentException: URI is not hierarchical
at java.io.File.<init>(File.java:363)
Any suggestions about what to do here? I'm pretty confused about how
to fix this issue.
Thanks
current setup (names have been changed of the JAR files).
JAR1.jar - This is the JAR that will try to access the text.properties
file. (This is a library that is being used by JAR2.jar)
JAR2.jar
- path/to/text.properties (this is the file I'm trying to access)
Here is the code I'm using to access the file.
URL propertiesUrl = ClassLoader.getSystemResource(DEFAULT_PATH +
FILE);
This works when I'm within Eclipse (most likely because the file is
not in a JAR from what I can tell.) However, as soon as I package up
the files into their respective JARs using ANT and I try to run the
executable jar (JAR2), I receive an error...
Exception in thread "main" java.lang.ExceptionInInitializerError
Caused by: java.lang.IllegalArgumentException: URI is not hierarchical
at java.io.File.<init>(File.java:363)
Any suggestions about what to do here? I'm pretty confused about how
to fix this issue.
Thanks