Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Using JDTCompilerAdapter from inside ant executed programmatically
Using JDTCompilerAdapter from inside ant executed programmatically [message #532091] Fri, 07 May 2010 03:24
Eclipse UserFriend
What I need is to simply run ant script (which in turn calls javac) programatically from inside eclipse-based program. It runs as external tool just fine, so did not expect any problems here.

First I tried to use standard jdk javac to do this (because running this script as external tool from inside IDE worked ok), but met "JAVA_HOME/jre" ant problem which makes suffering for the big part of internet, but by some reason was never fixed in ant itself - none of the suggested workarounds did work for my case.

So I have decided to use eclipse compiler instead of jdk javac and quickly found many instructions which seemed to require simple setting for build.compiler property to org.eclipse.jdt.core.JDTCompilerAdapter value.

So I use ant api which starts the script ok, but when it comes to compile time, is shows me error "org.eclipse.jdt.core.JDTCompilerAdapter is not found in classpath" (though I have added org.eclipse.jdt.core.jar to project classpath which seemed to be natural step).

After some time I have found that JDTCompilerAdapter class is not located in org.eclipse.jdt.core.jar, but it is put inside another jar file.

Can please someone explain me what is the point in storing org.eclipse.jdt.core.JDTCompilerAdapter class packed inside jdtCompilerAdapter.jar which is in turn is located inside the original org.eclipse.jdt.core.jar library.

http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .jdt.doc.isv/guide/jdt_api_compile.htm

gives some instructions:
>inside Eclipse using the different JRE: the Eclipse batch compiler must be explicitely added to the ant runtime classpath. This can be done using the ecj.jar file or using the org.eclipse.jdt.core jar file and the jdtCompilerAdapter.jar file located inside the org.eclipse.jdt.core jar file (this jar file needs to be extracted first)

but without any explanations why I should extract this jar from another jar. Can please someone tell me what is the point in using such a softly saying non-evident solution.


Even more, when I have extracted jdtCompilerAdapter.jar from containing jar, the program did not take required class from classpath because jdtCompilerAdapter.jar is not an OSGI bundle.

And even more, after applying bnd tool to jdtCompilerAdapter.jar and adding it as plugin dependency to project, the project does not build showing errors like "Access restriction: The method XXX from JavaCore is not accessible to due to restriction on required library org.eclipse.jdt.core.jar"
Previous Topic:Globally detecting double click in editor
Next Topic:Impossible to change font in the Outline view in mac os X
Goto Forum:
  


Current Time: Tue Jul 15 12:11:05 EDT 2025

Powered by FUDForum. Page generated in 0.03672 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top