在普通的Java应用程序中,可以使用以下命令打印类路径的内容:
String ss = System.getProperty("java.class.path");
System.out.println(ss);
Run Code Online (Sandbox Code Playgroud)
但是如何打印使用eclipse PDE向导创建的OSGI包的类路径?在激活器中,可以获得当前的捆绑包:
public void start(BundleContext context)抛出Exception {super.start(context); plugin = this;
Bundle b = context.getBundle();
// java doc: This bundle's class loader is not used to search for entries.
b.findEntries(path, filePattern, recurse)
Run Code Online (Sandbox Code Playgroud)
但是javadoc说findEntries不使用类加载器.有没有简单的方法来查看/打印当前包的类路径上的内容?