如何在Eclipse中将Java属性文件添加到我的Java项目中 [英] How to add a Java Properties file to my Java Project in Eclipse

查看:92
本文介绍了如何在Eclipse中将Java属性文件添加到我的Java项目中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我之前使用Unix编译和编辑我的Java。因为我已经在我目前的工作目录中使用属性文件,该文件存在于该文件中。现在我已经切换到Eclipse IDE。我不知道如何在Eclipse中添加相同的属性文件。请帮助我。

I was using Unix before to compile and edit my Java. In that I have used property files right inside my current working directory where the class file exists. Now i have switched to Eclipse IDE. I dont know how to add the same properties file here in Eclipse. Please help me.

推荐答案

如果您在当前工作目录中有属性文件,它应该在Unix中正常工作。另一个选择是将您的属性文件添加到类路径,并使用 this.getClass()获取输入流getClassLoader()。getResourceAsStream(xxxxx.properties);
更多 here

It should work ok as it is in Unix, if you have properties file in current working directory. Another option would be adding your properties file to the classpath and getting the inputstream using this.getClass().getClassLoader().getResourceAsStream("xxxxx.properties"); More here

这篇关于如何在Eclipse中将Java属性文件添加到我的Java项目中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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