0

I want to run mainframe application in headless mode using HACL library and Jframe configuration, I have done the below configuration and setvisible property false.

  `term = new Terminal(p);
        session = term.getECLSession();
        ps = session.GetPS();
        ps.setCursor();

        jf = new JFrame();
        jf.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        jf.setSize(3440, 2160);

        termPanel = new JPanel();
        termPanel.setLayout(new GridLayout(1, 1));
        termPanel.add(term);
        cont = jf.getContentPane();
        cont.add(termPanel);
        jf.setBackground(Color.WHITE);
        jf.setForeground(Color.BLACK);

        jf.validate();
        jf.requestFocus();

        jf.setVisible(false);
        logger.info("setvisible");
        jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        logger.info("endoflaunch");
        jf.setExtendedState(Frame.MAXIMIZED_BOTH);`

Getting the nullpointer exception while capturing the getScreen function

`public String getScreenShot() throws IOException {
        Component comp = ma.term.getScreen().getComponent(0);
        BufferedImage img = new BufferedImage(comp.getWidth(), comp.getHeight(), BufferedImage.TYPE_INT_RGB);
        comp.paint(img.getGraphics());
        String sName = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
        File outputfile = new File("results/Screenshots/", sName + ".png");
        outputfile.mkdirs();
        ImageIO.write(img, "png", outputfile);
        return outputfile.getAbsolutePath();
    }`

I have tried to execute the mainframe application in headless mode and setvisible property false but getting NullpointerPointer Exception in getScreenShot function.

vishwa
  • 31
  • 11

0 Answers0