emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [BUG] Possible Outdated Documentation, Possible Bug. "Can't compile a java block without a classname." Org-babel babel java
@ 2021-09-22  2:06 uruseiiyatsura
  2022-10-20  2:58 ` Ihor Radchenko
  0 siblings, 1 reply; 2+ messages in thread
From: uruseiiyatsura @ 2021-09-22  2:06 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 1151 bytes --]

[Java Source Code Blocks in Org Mode](https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-java.html) says the following:

"It is not necessary to include the class statement or define a main method. ob-java will wrap a source code block in boilerplate class and main method definitions if they are omitted. If :classname and the class definition in the source code block are both omitted, the class will be named Main."

The following example is provided:

#+begin_src java :results output
System.out.print("hello, world");
#+end_src

This returns error "can't compile a java block without a classname." This contradicts the documentation.

This has been duplicated on Gentoo and Ubuntu 20.04 in Emacs version 27.2. org version 9.4.4, 9.4.6 and 26.3 9.1.9 using the following .emacs.el:

(require 'org)
(org-babel-do-load-languages
'org-babel-load-languages
'(
(java . t)
))

The documentation appears to be outdated or misleading, or missing some crucial piece of information that a newbie needs to be aware of. Please advise on whether this is a bug and how to fix it. I am new to using the mailing list.

Upgrading to 9.4.6 did not fix this

[-- Attachment #2: Type: text/html, Size: 1680 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [BUG] Possible Outdated Documentation, Possible Bug. "Can't compile a java block without a classname." Org-babel babel java
  2021-09-22  2:06 [BUG] Possible Outdated Documentation, Possible Bug. "Can't compile a java block without a classname." Org-babel babel java uruseiiyatsura
@ 2022-10-20  2:58 ` Ihor Radchenko
  0 siblings, 0 replies; 2+ messages in thread
From: Ihor Radchenko @ 2022-10-20  2:58 UTC (permalink / raw)
  To: uruseiiyatsura; +Cc: emacs-orgmode@gnu.org

uruseiiyatsura <uruseiiyatsura@protonmail.com> writes:

> [Java Source Code Blocks in Org Mode](https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-java.html) says the following:
>
> "It is not necessary to include the class statement or define a main method. ob-java will wrap a source code block in boilerplate class and main method definitions if they are omitted. If :classname and the class definition in the source code block are both omitted, the class will be named Main."
>
> The following example is provided:
>
> #+begin_src java :results output
> System.out.print("hello, world");
> #+end_src
>
> This returns error "can't compile a java block without a classname." This contradicts the documentation.

Sorry for the late reply.
Your example works just fine on the latest Org.
I cannot reproduce the problem.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-10-20  3:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-22  2:06 [BUG] Possible Outdated Documentation, Possible Bug. "Can't compile a java block without a classname." Org-babel babel java uruseiiyatsura
2022-10-20  2:58 ` Ihor Radchenko

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).