emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Org-babel Java imports
@ 2017-09-15 14:56 Tim Jones
  2017-09-19  9:10 ` Eric S Fraga
  0 siblings, 1 reply; 4+ messages in thread
From: Tim Jones @ 2017-09-15 14:56 UTC (permalink / raw)
  To: emacs-orgmode

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

Hi
Want to create org docs with embedded java blocks which will generate
testing data

I have seen
http://ehneilsen.net/notebook/orgExamples/org-examples.html#sec-19
but have not been able to find an example where there are any import
statements e.g.
import java.time.*;

Can anyone tell me how I might achieve this?

Thanks,

Tim

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

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

* Re: Org-babel Java imports
  2017-09-15 14:56 Org-babel Java imports Tim Jones
@ 2017-09-19  9:10 ` Eric S Fraga
  2017-09-19  9:51   ` Tim Jones
  0 siblings, 1 reply; 4+ messages in thread
From: Eric S Fraga @ 2017-09-19  9:10 UTC (permalink / raw)
  To: Tim Jones; +Cc: emacs-orgmode

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

On Friday, 15 Sep 2017 at 14:56, Tim Jones wrote:
> Hi
> Want to create org docs with embedded java blocks which will generate
> testing data
>
> I have seen
> http://ehneilsen.net/notebook/orgExamples/org-examples.html#sec-19
> but have not been able to find an example where there are any import
> statements e.g.
> import java.time.*;

Can you not simply put this line as the first line of the actual source
block, i.e. after the #+begin_src?  (untested)
-- 
: Eric S Fraga via Emacs 26.0.50, Org release_9.0.10-729-gb792e2

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 194 bytes --]

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

* Re: Org-babel Java imports
  2017-09-19  9:10 ` Eric S Fraga
@ 2017-09-19  9:51   ` Tim Jones
  2017-09-19 15:52     ` Eric S Fraga
  0 siblings, 1 reply; 4+ messages in thread
From: Tim Jones @ 2017-09-19  9:51 UTC (permalink / raw)
  To: emacs-orgmode

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

Eric

Thanks for your reply

No - that's exactly what I did first, but it did not work.

I then tried preceding it with a package statement, which did not work
either.

It got me thinking that I had now idea how it could resolve dependencies,
whether for java packages, which you would expect to be on the classpath by
default and therefore could be found, or for external libraries, which
would usually be downloaded and put on the classpath by a tool like gradle
or maven.

Have you any insight into this or could you suggest whom I might ask?

Regards,

Tim

On Tue, Sep 19, 2017 at 10:10 AM Eric S Fraga <esflists@gmail.com> wrote:

> On Friday, 15 Sep 2017 at 14:56, Tim Jones wrote:
> > Hi
> > Want to create org docs with embedded java blocks which will generate
> > testing data
> >
> > I have seen
> > http://ehneilsen.net/notebook/orgExamples/org-examples.html#sec-19
> > but have not been able to find an example where there are any import
> > statements e.g.
> > import java.time.*;
>
> Can you not simply put this line as the first line of the actual source
> block, i.e. after the #+begin_src?  (untested)
> --
> : Eric S Fraga via Emacs 26.0.50, Org release_9.0.10-729-gb792e2
>

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

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

* Re: Org-babel Java imports
  2017-09-19  9:51   ` Tim Jones
@ 2017-09-19 15:52     ` Eric S Fraga
  0 siblings, 0 replies; 4+ messages in thread
From: Eric S Fraga @ 2017-09-19 15:52 UTC (permalink / raw)
  To: Tim Jones; +Cc: emacs-orgmode

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

On Tuesday, 19 Sep 2017 at 09:51, Tim Jones wrote:
> I then tried preceding it with a package statement, which did not work
> either.

No, a package statement should not be required.  The classname matches
the java code.

What worked for me, accessing a class in another package, was to put
".:PATH2OTHERPACKAGE" as the option for the command line.

> It got me thinking that I had now idea how it could resolve dependencies,
> whether for java packages, which you would expect to be on the classpath by
> default and therefore could be found, or for external libraries, which
> would usually be downloaded and put on the classpath by a tool like gradle
> or maven.

classpath management in Java is a nightmare (in my experience)
compounded by tools like maven and gradle.

In any case, could you post a minimal org example including a java block
that you would expect to work, e.g. the HelloWorld example with some
other class reference?  Include any error messages from the
execution of the org block.

Also, what version of org are you using?

-- 
: Eric S Fraga via Emacs 26.0.50, Org release_9.0.9-573-g09e612

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 194 bytes --]

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

end of thread, other threads:[~2017-09-19 15:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-15 14:56 Org-babel Java imports Tim Jones
2017-09-19  9:10 ` Eric S Fraga
2017-09-19  9:51   ` Tim Jones
2017-09-19 15:52     ` Eric S Fraga

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).