创建和可执行使用外部XML文件的JAR文件 [英] Creating and executable JAR file that uses an external XML file

查看:200
本文介绍了创建和可执行使用外部XML文件的JAR文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Eclipse中有一个java应用程序,它使用像这样的eml文件

 文件匹配=新文件(匹配。 XML); 

该文件与所有其他类一样位于默认包中。当我创建JAR时,它会在XML文件中捆绑它。我的应用程序要求我能够更改XML文件。如何设置它以便JAR可以引用XML文件?

解决方案


我的应用程序要求我能够对XML文件进行更改。


然后你需要从Jar中提取它并将它保存在本地文件系统的某个地方。



有关更多详细信息,请参阅应用如何使用JAR内的文件进行读写?。 p>

I have a java application in Eclipse that uses an eml file like so

File matches = new File("matches.xml");

The file is located in the default package as all the other classes. When I create the JAR it bundles in the XML file with it. My application require me to be able to make changes to the XML file. How can I set it up so the JAR can reference the XML file outside of itself?

解决方案

My application require me to be able to make changes to the XML file.

Then you will need to extract it from the Jar and save it somewhere on the local file system.

See How can an app use files inside the JAR for read and write? for more details.

这篇关于创建和可执行使用外部XML文件的JAR文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆