title: Task.Call() not working -- Eclipse Plug-in
body: <p>I am creating an Eclipse plug-in that is compiling JAVA files upon click of the plug-in button.</p>
  
  <p>Thanks to this <a href="https://stackoverflow.com/questions/21544446/how-do-you-dynamically-compile-and-load-external-java-classes/21544850#21544850">StackOverflow Question</a>, MadProgrammer gave the perfect solution for the requirement. I now have a project that can compile and run classes from an external folder.</p>
  
  <p>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 <code>task.call()</code> is not working. </p>
  
  <p>The code by MadProgrammer that works in a JAVA project class:</p>
  
  <pre><code>     DiagnosticCollector&lt;JavaFileObject&gt; diagnostics = new DiagnosticCollector&lt;JavaFileObject&gt;();
       JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
       StandardJavaFileManager fileManager = compiler.getStandardFileManager(diagnostics, null, null);
       List&lt;String&gt; optionList = new ArrayList&lt;String&gt;();
       optionList.add("-classpath");
       optionList.add(System.getProperty("java.class.path") + ";dist/InlineCompiler.jar");
       Iterable&lt;? extends JavaFileObject&gt; compilationUnit = fileManager.getJavaFileObjectsFromFiles(Arrays.asList(listOfFiles));
       JavaCompiler.CompilationTask task = compiler.getTask(null, fileManager, diagnostics, null, null, compilationUnit);
       if (task.call()) { 
             //insert logic here 
       }
  </code></pre>
  
  <p>The only difference that I found is that if I run the code in a JAVA class, <code>System.getProperty("java.class.path")</code> returns the build path of the JAVA project. However, when I run the code as a plug-in, the same code returns:
  <code>C:\Users\xxxxxx\Desktop\eclipse\plugins\org.eclipse.equinox.launcher_1.3.100.v20150511-1540.jar</code></p>
  
  <p>I am quite unsure if this is really the reason why <code>compiler.getTask()</code> isn't working. Aside from that, everything else is the same: this includes the classes to be compiled, the jdk version, etc.</p>
  
  <p>Any input or advice on what should I do is greatly appreciated!</p>
  
  <p>Thank you!</p>
  
  <p><strong>Update:</strong> I found out that the JAVA project works even without:</p>
  
  <pre><code> List&lt;String&gt; optionList = new ArrayList&lt;String&gt;();
   optionList.add("-classpath");
   optionList.add(System.getProperty("java.class.path") + ";dist/InlineCompiler.jar");
  </code></pre>
  
  <p>and setting null at the option list for <code>compiler.getTask()</code>, so I'm looking into the files that are being compiled, but so far, they're the same with the exception for the name of the package in the <code>implements</code>.</p>
  
  <p><strong>2nd Update:</strong> Diagnostics showed the following errors: <code>package xxxxplugin_handlers.CheckHandler does not exist</code> and <code>method does not override or implement a method from a supertype</code>.</p>
  
  <p>Here's a snippet of the file I am trying to compile:</p>
  
  <pre><code>public class checkClass implements xxxxplugin.handlers.CheckHandler.DoStuff{
  
  @Override
  public String doStuff(String code)
  {
      //class function here
  }
  </code></pre>