运行基于jface的程序时,有时会出现 can not find main class 错误. 而程序看起来似乎毫无错误.这时应该检查一下jface的依赖项. 而jface在不同的版本却有不同的依赖项,应该如何找到你所使用的jface的依赖项呢?不用google了,这里有你要的答案.
打开eclipse菜单: Window/Show View/PDE/Plug-ins.
这样,就打开了Plug-in Dependencies视图.
选择jface,这样就可以得到dependencies,将相应插件添加进build path就可以了.
参考:
[urlhttp://wiki.eclipse.org/JFace#Identify_the_Required_External_JAR_Files_for_SWT_and_JFace][/url]
原文:
Identify the Required External JAR Files for SWT and JFace
A JFace project requires the SWT classes, JFace classes, and other Eclipse classes that JFace is dependent on. The SWT classes will be provided in the file we download from the SWT Project Website. The JFace file, and the files the JFace is dependent upon, need to be added to the project manually.
The first step is to identify the required JAR files for JFace. The primary file is called org.eclipse.jface, followed by specific version information. In addition, this file requires classes from other Eclipse JAR files. For Eclipse version 3.3.1.1, the required JAR files for JFace are as follows (where <version info> is the specific version information):
org.eclipse.core.commands_<version info>.jar
org.eclipse.equinox.common_<version info>.jar
org.eclipse.jface_<version info>.jar
org.eclipse.osgi_<version info>.jar
org.eclipse.ui.workbench_<version info>.jar
The file org.eclipse.ui.workbench_<version info>.jar is not required to run the standard JFace classes. However, since it adds a number of very useful Dialogs (such as ListDialog, ListSelectionDialog, and others), it is included here as well.
You can find the JFace dependencies for any Eclipse version if you have the Plug-in Development Environment, which includes the Plug-ins and Plug-in Dependencies views. To do this:
1.Select Window/Show View/PDE/Plug-ins. (Note, if you don't have a PDE view folder, it means you don't have the Plug-in Developer Environment plug-in in your Eclipse installation.)
2.Select the org.eclipse.jface plug-in from the list.
3.Right-click and select Open Dependencies. This will open the Plug-in Dependencies view. An example of this view for Eclipse version 3.3.1.1 is shown below.
4.Press the Set Flat Layout button to see a simple flat list of the required plug-ins, as shown below.
5.Each plug-in on the list corresponds to a JAR file in the plugins directory for your Eclipse installation. If the list for your Eclipse version is different than the list above, make a note of it and modify the remaining instructions accordingly. At this point, we have the list of JAR files that we need.