开发者

Finding paths for packaged non-java files at runtime

So this might be a stupid question but...

I want to package a specific WSDL file in with an EJB project within eclipse.开发者_如何学C What would be the best way to refer to this file in my code?

I would like to use a relative path but the current directory starts off in the /bin directory of my JBOSS installation. It seems like there should be a way to refer to the file in relation to the project file structure.

Any ideas?


getClass().getResource(String path) uses a relative path to locate a classpath resource. It returns a java.net.URL. Alternatively, you can use getResourceAsStream(..) to obtain the InputStream to the resource.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜