I have a similar issue like that JavaCompiler not compiling files properly. I get also the error error: cannot find symbol but I use my own interface that the class should implements.
My class looks like:
String className = "refac.MyClass";
String javaCode = "package refac;\n" +
"import refac.IBewertungsAlgorithmus;\n" +
"public class MyClass implements IBewertungsAlgorithmus{\n" +
" public Boolean Bewertung (int checkliste){\n" +
" System.out.println(\"Hello World\");\n" +
" return false; }\n" +
"}\n";
I get this compilation error:
[/refac/MyClass.java:2: error: cannot find symbol
import refac.IBewertungsAlgorithmus;
^
symbol: class IBewertungsAlgorithmus
location: package refac, /refac/MyClass.java:3: error: cannot find symbol
public class MyClass implements IBewertungsAlgorithmus{
^
symbol: class IBewertungsAlgorithmus]
The class and the interface are in the same package - seemingly.
System.getProperty("java.class.path") returns
C:\Users\Plath\Axon\Neu\AxonIvyDesigner\AxonIvyDesigner6.7.1.55496_Windows_x64\plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar;
This isn't the project path. How do I get the class path of a web projekt?
I found a way to create the correct class path to be the same as the runtime's.
Now the class is compiled correctly.