Eclipse书籍部分翻译(英译中)5

来源:百度知道 编辑:UC知道 时间:2024/09/21 08:46:48
External plug-in JARs
When it comes time to deploy your application and the JDBC plug-in, you have to rely on a native installer or feature install handler to set up the plug-in's manifest and ensure that jdbc.jar is in fact installed. The task is quite a bit easier if the database product defines environment variables or Java system properties, as shown in the example, to describe the location of its install. For example, if the product defined JDBC_HOME as an environment variable, then you can set up the JDBC plug-in's manifest to include the line:
Bundle-Classpath: external:$JDBC_HOME$/drivers/jdbc.jar
This mechanism has the added benefit that the JDBC plug-in can be built and delivered using standard Eclipse mechanisms. Variables make this even easier.
The real danger in using this setup is the potential for mismatching the metadata and contents of the JARs. For example, you might generate the metadata based on version 3 of the JDBC drivers, but the actu

外部插件罐子
当时间来部署您的应用程序和数据库插件,你就必须依赖于一个本地安装或安装处理功能设置插件的清单,并确保jdbc.jar实际上是安装。这个任务是相当容易,如果数据库产品定义环境变量或Java系统属性,如范例中所示,用来描述它的位置安装。例如,如果产品的界定JDBC_HOME作为一个环境变量,那么你可以建立数据库插件的清单,包括行:
束类路径:外部: $ JDBC_HOME $ /司机/ jdbc.jar
这一机制的额外好处的JDBC的插件才能建立并交付使用标准的Eclipse机制。使这个变量更容易。
真正的危险在使用此设置的潜力不匹配的数据和内容的罐子。例如,您可能会产生数据的基础上,第3版的JDBC的驱动程序,但实际安装的驱动程序的版本2 。追踪这些类型的错误是具有挑战性的,至少可以说。尽管如此,该机制的存在,并解决一些实际问题。使用它谨慎和小心。
Classloading问题疑难解答
大多数代码库是相当简单的捆绑,然后使用基于Eclipse的系统。你见过的向导创建的插件从现有的罐子并不大部分为你工作。但发生的事情,如果有问题后,捆绑?如果你还记得从第10章,捆绑后,画,未来的事情我们能做的就是写一个测试插件,看看是否画可参照的一个插件。在这一点上,有两个主要问题,这些问题可能会发生。首先是在编译timeclasses的捆绑JAR文件可能不会明显。这是很容易固定,确保插件捆绑含有绒毛膜出口一切必要的软件包从JAR文件。但是,如果出错在运行时?典型的症状是ClassNotFoundExceptions和NoClassDefFoundErrors显示在控制台或日志文件。
这整个一节是专门帮助您了解和解决这些运行时错误。通常情况下,这些涉及到classloading结构固有的Eclipse和的OSGi 。的OSGi classloading的战略和机制,讨论了第26章,但在这里我们详细一些标准库的编码方式和如何处理它们在Eclipse 。
问题Class.forName ( )