From: ian martins <ianxm@jhu.edu>
To: John Herrlin <jherrlin@gmail.com>
Cc: Org-Mode mailing list <emacs-orgmode@gnu.org>
Subject: Re: ob-java compile only
Date: Sun, 27 Sep 2020 21:53:38 -0400 [thread overview]
Message-ID: <CAC=rjb7FZNZWR+AvqQeKT5TcFstYPVWZWmJt2_nmA-FG+NRFXA@mail.gmail.com> (raw)
In-Reply-To: <87imbyapel.fsf@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1779 bytes --]
Hi John,
Thanks for the suggestion and patch. Is the reason for this so that you can
have classes without needing dummy "main" methods?
Did you consider using org-babel-tangle to generate the source files? This
works for me:
Steps:
1. put javatangle.org (below) on your local.
2. create "pkg" directory where javatangle.org is
3. run org-babel-tangle on javatangle.org (this writes two source files to
the pkg dir)
4. run C-c C-c on the top source block (this compiles both source files and
runs main)
----- javatangle.org -----
#+begin_src java :results output :classname pkg/Main :tangle pkg/Main.java
package pkg;
public class Main {
public static void main(String[] args) {
System.out.println(Hey.hey());
}
}
#+end_src
#+begin_src java :results output :classname pkg/Hey :tangle pkg/Hey.java
package pkg;
public class Hey {
public static String hey() {
return "hey";
}
}
#+end_src
On Sun, Sep 27, 2020 at 5:19 PM John Herrlin <jherrlin@gmail.com> wrote:
>
> Hey Ian!
>
> Happy to see you as the maintainer of the ob-java!
>
> I would like to propose a feature to ob-java. The feature allows a
> source code block to write and compile only, without executing.
>
> Here is a common use case for me.
>
> Class without a entry point have an :compile-only header.
>
> #+HEADER: :classname se/my_test_package/Hey
> #+HEADER: :dir src
> #+HEADER: :compile-only t
> #+HEADER: :results none
> #+BEGIN_SRC java
> package se.my_test_package;
>
> public class Hey {
> public static String hey(String name) {
> return "Hey " + name;
> }
> }
> #+END_SRC
>
> The provided diff works for my small use case. What do you think?
>
> --
> Best regards
> John
>
>
[-- Attachment #2: Type: text/html, Size: 2711 bytes --]
next prev parent reply other threads:[~2020-09-28 1:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-27 21:19 ob-java compile only John Herrlin
2020-09-28 1:53 ` ian martins [this message]
2020-09-28 8:11 ` John Herrlin
2020-09-29 2:18 ` ian martins
2020-09-29 19:22 ` John Herrlin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAC=rjb7FZNZWR+AvqQeKT5TcFstYPVWZWmJt2_nmA-FG+NRFXA@mail.gmail.com' \
--to=ianxm@jhu.edu \
--cc=emacs-orgmode@gnu.org \
--cc=jherrlin@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).