如何读取config.ini文件,它放在java的jar文件外面? [英] How to read config.ini file,which is placed in outside of jar file in java?

查看:314
本文介绍了如何读取config.ini文件,它放在java的jar文件外面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须在java中读取和处理config.ini文件,config.ini文件放在放置jar文件的目录中。请提供解决方案。

I have to read and process the config.ini file in java, config.ini file is placed in the directory where jar files are placed. Please provide solution.

推荐答案

首先,您必须获取jar文件所在的目录:http://stackoverflow.com/questions/320542/how-to-get-the-path-of-a- running-jar-file [ ^ ]

如果你有目录,那么在其中加载/处理文件很简单。
First you have to get the directory in which the jar file is located: http://stackoverflow.com/questions/320542/how-to-get-the-path-of-a-running-jar-file[^]
If you have the directory then loading/processing a file in it is straightforward.


这篇关于如何读取config.ini文件,它放在java的jar文件外面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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