[
https://issues.apache.org/jira/browse/IO-46?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17800500#comment-17800500
]
Elliotte Rusty Harold commented on IO-46:
-----------------------------------------
This doesn't seem like a good idea and IMHO should be won't fixed. Most
resources in classpaths are jar entries, not files. They should be loaded as
streams, not files.
> [io] Find file in classpath
> ---------------------------
>
> Key: IO-46
> URL: https://issues.apache.org/jira/browse/IO-46
> Project: Commons IO
> Issue Type: Improvement
> Components: Utilities
> Affects Versions: 1.1
> Environment: Operating System: other
> Platform: Other
> Reporter: David Leal
> Priority: Minor
> Fix For: 3.x
>
>
> Just to suggest adding a method like this:
> public File findFileInClasspath(String fileName) throws
> FileNotFoundException
> {
> URL url = getClass().getClassLoader().getResource(fileName);
> if (url == null){
> throw new FileNotFoundException(fileName);
> }
> return new File(url.getFile());
> }
--
This message was sent by Atlassian Jira
(v8.20.10#820010)