jaikiran pai [http://community.jboss.org/people/jaikiran] created the discussion

"Re: JBOSS 6: Exploded War - path not found"

To view the discussion, visit: http://community.jboss.org/message/628957#628957

--------------------------------------------------------------
> oakleyx wrote:
> 
> 
> Currently this is the code that i'm calling to return the path:
>   
> ClassLoader loader = Thread.+currentThread+().getContextClassLoader();
> 
> URL url = loader.getResource(*this*.filename);
> ..
> .. 
> String path = url.getPath();
> repos = *new*  File(path);
> 
> ..
> 
You have done that partially right. You shouldn't be using the absolute file 
path while working in Java EE environment. Instead, what you (typically) need 
to do is:

InputStream is = classLoader.getResourceAsStream(filename);
// then use the inputstream for further processing.

How do you use the "repos" later on in your code?
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/628957#628957]

Start a new discussion in Beginner's Corner at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2075]

_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to