2012-09-30 53 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月)這個網站不起作用。 –