return a value from a Java agent / JAR file to lotusScript
20:14 16 May 2024

have this Java code :

public class PdfByteReader {

    /**
     * @param args the command line arguments
     */
   public static void main(String[] args) {
        String filePath = args[0];
        try {
            String pdfContent = readPdfFileByteByByte(filePath);
            System.out.println(pdfContent);
        } catch (IOException e) {
            System.err.println("ERROR" + e.getMessage());
        }
    }

    public static String readPdfFileByteByByte(String filePath) throws IOException {
        File pdfFile = new File(filePath);
        StringBuilder content = new StringBuilder();

        try (FileInputStream fis = new FileInputStream(pdfFile)) {
            int byteRead;
            while ((byteRead = fis.read()) != -1) {
                content.append((char) byteRead);
            }
        }

        return content.toString();
    }
    
}

i can build a JAR file or create a Java Agent in a Lotus Notes app, but : how can i receive from lotus script the return value of this (string)?

i'm trying to parse a pdf file into string in order to upload to a API

java lotus-notes lotusscript