I've written an alternative org-java.el that doesn't have that problem. I wanted to add it to contrib/ but haven't been able to get access. if you want to try it I can post it somewhere.

On Thu, Jun 25, 2020 at 7:29 AM Jarmo Hurri <jarmo.hurri@iki.fi> wrote:

Greetings.

In the org file below, the first babel block will evaluate just fine,
while the second will signal "End of file during parsing". The
difference is the opening bracket "[" in output.

I think am running the most recent stable version:
Org mode version 9.3.7 (release_9.3.7-4-gba6ca7)

Thanks for any ideas.

Jarmo

# ---------------------------------------------------------------------------
* This will parse just fine
  #+name: OK
  #+begin_src java :exports results :classname OK :results output
    class OK
    {
      public static void main (String[] args) { System.out.println ("foo"); }
    }
  #+end_src

  #+RESULTS: OK
  : foo

* This will generate a parse error when evaluated
  #+name: BAD
  #+begin_src java :exports results :classname BAD :results output
    class BAD
    {
      public static void main (String[] args) { System.out.println ("[foo"); }
    }
  #+end_src