From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric S Fraga Subject: Re: How-to evaluate Java-snippets in org-mode/org-babel? Date: Tue, 05 Jul 2011 10:07:19 +0100 Message-ID: <87tyb1jdtk.fsf@pinto.chemeng.ucl.ac.uk> References: <4E12B6DB.4090001@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([140.186.70.92]:49704) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qe1bT-0004Zi-Jm for emacs-orgmode@gnu.org; Tue, 05 Jul 2011 05:07:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qe1bR-00068K-D5 for emacs-orgmode@gnu.org; Tue, 05 Jul 2011 05:07:35 -0400 Received: from vscani-e.ucl.ac.uk ([144.82.108.33]:53634) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qe1bQ-00066p-Uz for emacs-orgmode@gnu.org; Tue, 05 Jul 2011 05:07:33 -0400 In-Reply-To: <4E12B6DB.4090001@gmail.com> (Torsten Wagner's message of "Tue, 05 Jul 2011 16:01:47 +0900") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Torsten Wagner Cc: Org Mode Mailing List Torsten Wagner writes: > Hi all, > > I need to evaluate many small java snippets. I tried to do this in > org-mode but so fare it didn't work out. org-babel seems to have no > java support ? Not directly but, given the issues with class paths and naming schemes, I would suggest that the best route is to use babel to tangle code instead of trying to execute it directly within org. So, for instance, you might have: --8<---------------cut here---------------start------------->8--- #+begin_src java :tangle "mypackage/myclass.java" package mypackage; public class myclass { ... } #+end_src --8<---------------cut here---------------end--------------->8--- Then "C-c v t" in org will put the code into the appropriate file. You can have different snippets of code (e.g. each individual method in the class) as separate source code blocks which can be tangled to the same file. You can also have different destinations for tangling in the case that you have different classes. Finally, you could then have a shell script, within org, to execute the particular Java class you want: --8<---------------cut here---------------start------------->8--- #+begin_src sh :results output javac -cp . mypackage/myclass.java java -cp . mypackage.myclass #+end_src --8<---------------cut here---------------end--------------->8--- Untested but I do this (on Linux, not sure about Windows however) with Octave all the time, despite Octave being supported by org directly. When I have multiple functions, this approach is easier. HTH. -- : Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.50.1 : using Org-mode version 7.5 (release_7.5.574.g5a503)