简体   繁体   中英

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 eclipse

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

包含 XML的目录放在运行时类路径中,然后使用className.Class.getResourceAsStream()来获取包含XML的InputStream。

将它放在java源文件夹中,并将其用作资源

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM