rcp classpath
来源:互联网 发布:ps4经典游戏知乎 编辑:程序博客网 时间:2024/06/01 07:27
Amit Rana wrote:
> Hello Mauro,
> Thanks for responding.
>
> I checked and all the required files (including the log4j.xml,
> hibernate.cfg.xml) are selected.
>
> My app is not even recognising these files in PDE runtime.
If previously those libraries were finding those files automatically
through some relative path or your were telling the libraries where to
find those files using a relative path that relative path will now be
broken. I do not know the API for those libraries from your example but
if you know how to tell those libraries where to find a config file you
can determine a real file system path to point them to. Here is an
example that sets up the system property to find a .dll for JNI usage
(with non relevant code removed - so even though this comes from a working
system I have not compiled this exact snippet).
1 // Get the bundle object
2 Bundle bundle = MyPlugin.getDefault ().getBundle ();
3
4 // Find the lib directory
5 String libDirectoryPath = null;
6 URL bundleLocation = bundle.getEntry ("/lib");
7 try {
8 // Resolve the URL
9 URL libURL = Platform.resolve (bundleLocation);
10 File libDirectory = new File (libURL.getFile ());
11 libDirectoryPath = libDirectory.toString ();
12
13 // Add the lib directory to the system's library path
14 String systemLibraryPath = System.getProperty ("java.library.path");
15 StringBuffer newLibraryPath = new StringBuffer (libDirectoryPath);
16 newLibraryPath.append (File.pathSeparator).append (systemLibraryPath);
17 System.setProperty ("java.library.path", newLibraryPath.toString());
18 } catch (Exception e) {
19 // Report the problem some how
20 }
At line 6 the path for getEntry is relative to your plug-in's root. So
your congif files need to be in a top level directory under your plug-in.
After you resolve your location as in line 9 the URL now points to the
file in a way that will allow you to get a file path.
Ian
- rcp classpath
- RCP
- rcp
- RCP
- RCP
- RCP
- RCP
- rcp
- rcp
- RCP
- classpath
- classpath
- CLASSPATH
- classpath
- classpath
- classpath
- classpath
- classpath
- 理想价位的几款笔记本
- Linux 下 C 语言编程
- QDII制度5月1日落实 金蝶国际等港股成受益者
- 开发Spring MVC应用程序(1)
- 徐少春套现350万份股权 某基金组织买入
- rcp classpath
- 开发Spring MVC应用程序(2)
- 开发Spring MVC应用程序(3-1)
- 《经济观察报》金蝶:共生能力
- 开发Spring MVC应用程序(3-2)
- 筛法的应用
- 开发Spring MVC应用程序(3-3)
- 音序检索汉字之我见
- “英文简历常用词汇”大全(精)