2012-09-30 50 views
3

我正在尝试使用命令行编译Eclipse JDT - Abstract Syntax Tree (AST) and the Java Model - Tutorial在Java中查找eclipse/jdt的jar依赖关系

我想出了这个命令行,它基于eclipse indigo中的plugins目录中的名称匹配。

javac -cp .:\ 
org.eclipse.core.runtime_3.7.0.v20110110.jar:\ 
org.eclipse.equinox.common_3.6.0.v20110523.jar:\ 
org.eclipse.core.commands_3.6.0.I20110111-0800.jar:\ 
org.eclipse.core.resources_3.7.100.v20110510-0712.jar:\ 
org.eclipse.jface.text_3.7.1.r371_v20110825-0800.jar:\ 
org.eclipse.jdt.core_3.7.1.v_B76_R37x.jar:\ 
org.eclipse.jdt_3.7.1.v201109091335.jar \ 
SampleHandler.java 

问题是,我仍然得到这4个错误。

SampleHandler.java:19: cannot find symbol 
symbol : class Document 
location: package org.eclipse.jface.text 
import org.eclipse.jface.text.Document; 
          ^
SampleHandler.java:28: cannot access org.eclipse.core.runtime.jobs.ISchedulingRule 
class file for org.eclipse.core.runtime.jobs.ISchedulingRule not found 
    IProject[] projects = root.getProjects(); 
          ^
SampleHandler.java:87: cannot find symbol 
symbol : class Document 
location: class handlers.SampleHandler 
    Document doc = new Document(unit.getSource()); 
    ^
SampleHandler.java:87: cannot find symbol 
symbol : class Document 
location: class handlers.SampleHandler 
    Document doc = new Document(unit.getSource()); 
        ^
4 errors 

我有更多的错误,但随着this hint的帮助下,我可以添加org.eclipse.equinox.common_3.6.0.v20110523.jar删除许多错误。

看起来jar名称可能不会反映包导入名称。 如何知道应该添加哪些jar文件来删除错误?

回答

1

我发现http://www.jarfinder.com很有用。使用这个网站,我可以给类名称找到可用的eclipse版本的jar名称。

例如,我可以搜索org.eclipse.jface.text.Document

enter image description here

点击类的,我能确定的jar文件的名称。

enter image description here

即使最新的Eclipse的信息是不可用的,我能猜出罐子名。

+0

不错,但在这一刻(2015年11月)这个网站不起作用。 –