开发者

how to add an xml file to the java application's classpath in eclipse?

I need an xml file to be accessed via the classpath in a java application i am creating . how to achieve it in eclip开发者_如何学Pythonse


I'd generate a separate resources folder, right-click it and select Build Path > Use as Source Folder. That way it's on the class path, but you're not mixing it with your Java source files


Put it in java source folder, and use it as resource


Put the directory containing the XML in the runtime classpath, then use className.Class.getResourceAsStream() to get an InputStream containing the XML.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜