In Org Mode in Emacs, while writing Java src code blocks, all src code blocks get wrapped in some boilerplate code. The boilerplate code includes the default class name which is Main and a main function. The boilerplate code is not included if src code block contains a class declaration, but in all other cases it is added.
I am trying to write a public enum in src code block. When evaluating this src code block the public enum gets wrapped in the boilerplate code which then causes compilation error.
Is there a way to prevent Org Babel from automatically wrapping src code block in boilerplate code and instead use the code in src code block as it is.
BTW I am using Doom Emacs distribution of Emacs.

I tried searching online but couldn't get a proper answer, hence I am writing this issue.
Looking into
org-babelinternals, we can see, thatorg-babel-execute:javacallsorg-babel-java--expand-for-evaluationfunction, docstring of which states:So this should be an expected behavior in order to prevent errors evaluating a source block.
As for the compilation error, Java Error: illegal start of expression seems to address it.
[The question text & screenshot doesn't look fully aligned to me. Not having Java setup currently to verify, I might miss something.]