[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.platform.swt] How to visit properties file in the Eclipse-plugin project?
|
Hi,
I have a preferences page in my Eclipse-plugin project and I want
to save the info of the page to config.properties.
The project structure is like this:
TestPlugin
|
|---src
| |
| com.test.plugin
| |--xxx.java
|
|---JRE System Library
|---Plug-in Dependencies
|---icons
|
|---plugin.xml
|---config.properties
I tried to use like this:
Properties prop = new Properties();
String absoluteUsrPath =
Thread.currentThread().getContextClassLoader().getResource("").toString();
int length = absoluteUsrPath.length();
// delete "bin/"
absoluteUsrPath.substring(0, length - 4) + "config.properties";
InputStream is = new FileInputStream(absoluteUsrPath);
prop.load(is);
But it doesn't work. If it's a Java Project it do work but now it's
a plugin-project and it will be used a jar file.
How to read and write the properties file in the plugin develeopment?
Thanks in advance!