| Author |
Directory / File not found
|
Paulo Carvalho
Ranch Hand
Joined: Nov 12, 2008
Posts: 56
|
|
Hello
I deployed a WAR file into Tomcat. This WAR file has a JAR file inside. Inside this JAR file, there is a directory structure: a directory called "mods" with a "fr" subdirectory.
So, the JAR file have something like this:
...
META-INF
mods
fr
...
The JAR file has a java class which tries to access the mods/fr directory:
Unfortunally, the directory is not found.
I have put the following lines to verify this:
=> it prints "C:\Programs\apache-tomcat-6.0.24\bin\mods\fr"
=> it prints "false" and "false".
What am I missing? how can I do for mods/fr directory to be found my the class of the JAR which is into the WAR file?
Thanks
Best regards
|
 |
Ogeh Ikem
Ranch Hand
Joined: May 13, 2002
Posts: 180
|
|
Hello Paulo. Are you trying to access a resource in that directory? In that case,
use this
or this
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56150
|
|
|
A jar file is not a file system. You cannot use file I/O. As pointed out, you must obtain it as a resource.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Paulo Carvalho
Ranch Hand
Joined: Nov 12, 2008
Posts: 56
|
|
Hello
Thanks for the answers.
In fact, what I want to do is to access the "mods/fr" directory which is in the JAR file and list all the files that ends with the "txt" extension.
So, resuming, I don't have the name of the ressource files, I just have the name of the directory where they are...
How can I list all the "txt" files present in the directory?
Thank you
Regards
|
 |
Ogeh Ikem
Ranch Hand
Joined: May 13, 2002
Posts: 180
|
|
Use this code to print the name of every file in a jar file.
You can implement a simple filter to print only the names of files in the "mods/fr" directory that end with the "txt" extension.
|
 |
Paulo Carvalho
Ranch Hand
Joined: Nov 12, 2008
Posts: 56
|
|
Thanks for the clue.
I will try it.
Best regards
|
 |
 |
|
|
subject: Directory / File not found
|
|
|