Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Finding jar dependencies for eclipse/jdt in Java

I'm trying to compile Eclipse JDT - Abstract Syntax Tree (AST) and the Java Model - Tutorial using command line.

I came up with this command line based on the name match in plugins directory in eclipse indigo.

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

The problem is that I still get these 4 errors.

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

I had much more errors, but with the help of this hint, I could add org.eclipse.equinox.common_3.6.0.v20110523.jar to remove many errors.

It seems like that the jar name might not reflect the package import name. How can I know what jar files should be added to remove the errors?

like image 915
prosseek Avatar asked Apr 21 '26 22:04

prosseek


1 Answers

I found http://www.jarfinder.com pretty useful. Using this site, I could give the class name to find the jar name for available eclipse releases.

For example, I could search org.eclipse.jface.text.Document

enter image description here

By clicking the class, I could identify the name of the jar file.

enter image description here

Even though the newest eclipse information is not available, I could guess the jar name.

like image 160
prosseek Avatar answered Apr 24 '26 10:04

prosseek



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!