public class AplotPdfPrintLocal extends ApplicationWindow {
private String userSelectedFile;
public AplotPdfPrintLocal(String pdfFilePath) {
super(null);
this.userSelectedFile = pdfFilePath;
}
public void run() {
setBlockOnOpen(true);
open();
Display.getCurrent().dispose();
}
etc........
I want to execute the above class from Class B
Method is class B – below
public void startPDFPrint() throws Exception {
AplotPdfPrintLocal pdfPrint = new AplotPdfPrintLocal(getPDFFileName()).run();
}
I am getting a error that I need to change the return type of run from void to plotPdfPrintLocal
Am I going about calling the class wrong?
Change it to:
or
what the compiler is saying is that you’re trying to assign the result of the run method (void) to left member of the expression, the AplotPdfPrintLocal pdfPrint variable.
So, due to the fact that run is “returning” void, there is an error, a discrepancy between the expected AplotPdfPrintLocal type (declared on the left side) and the actual return type: void.