crankshaft crankshaft - 6 months ago 31
Java Question

Java compiling .java with 'extends' fails

I am trying to compile the pentaho samples on OSX from here. extends

I have exported the CLASSPATH in the console to include the pwd:

export CLASSPATH=/Users/xxx/java-dev/pentaho/:/Users/xxx/java-dev/pentaho/lib/

I have compiled
successfully using
, into the same folder as the
file, however when I try and compile
it always fails with 3 errors related to

Any suggestion on the cause and solution ?

Folder structure:

Working Folder >
- AbstractReportGenerator.class
- AbstractReportGenerator$1.class
- AbstractReportGenerator$OutputType.class
- lib
- pentaho .jar files


javac -cp "lib/*" error: cannot find symbol
public class Sample1 extends AbstractReportGenerator
symbol: class AbstractReportGenerator error: cannot find symbol
final ClassLoader classloader = this.getClass().getClassLoader();
symbol: method getClass() error: package AbstractReportGenerator does not exist
new Sample1().generateReport(AbstractReportGenerator.OutputType.PDF, outputFilename);
Note: uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
3 errors


Thanks so much for all the suggestions, after adding a target folder, this suggestion from @Roman Vottner finally worked:

javac -cp ./lib/*:./target -d ./target