Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » Using JavaCompiler within a Plug-in: Package does not exist
Using JavaCompiler within a Plug-in: Package does not exist [message #1735820] Thu, 23 June 2016 02:59
Raye Raymundo is currently offline Raye RaymundoFriend
Messages: 1
Registered: June 2016
Junior Member
Hi all,

am creating an Eclipse plug-in that is compiling JAVA files upon click of the plug-in button.

Thanks to a StackOverflow question, the answerer gave the perfect solution for the requirement. I now have a project that can compile and run classes from an external folder.

Now, I am trying to port this into a plug-in. I have created the commands and tried to plug the same code into the plug-in code but nothing happens. I found out that is returning 'false'.

The code by the answerer that works in a JAVA project class:

     DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<JavaFileObject>();
     JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
     StandardJavaFileManager fileManager = compiler.getStandardFileManager(diagnostics, null, null);
     Iterable<? extends JavaFileObject> compilationUnit = fileManager.getJavaFileObjectsFromFiles(Arrays.asList(listOfFiles));
     JavaCompiler.CompilationTask task = compiler.getTask(null, fileManager, diagnostics, null, null, compilationUnit);
     if ( { 
           //insert logic here 

Diagnostics showed the following errors: package xxxxplugin_handlers.CheckHandler does not exist and method does not override or implement a method from a supertype.

Here's a snippet of the file I am trying to compile:

public class checkClass implements xxxxplugin.handlers.CheckHandler.DoStuff{

public String doStuff(String code)
    //class function here

And yes, the package is within the plug-in, it's the default package for handlers.

I am currently stuck. It is really weird that all other handles within that package are working fine (exception of course, this one because it uses JavaCompiler class). Any idea on how to resolve this?
Previous Topic:Enabling the Plug-In Spy
Next Topic:Reusing the eclipse plug in to create the customized plug in
Goto Forum:

Current Time: Tue Nov 13 17:43:14 GMT 2018

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

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

Back to the top