Is it possible to emply Jshell whithin org-babel

139 Views Asked by At

In the Jshell, we could interact with codes as:

jshell> 60 * 60
$1 ==> 3600 

However, the arithmetic expression should be encapsulated in class when using org-babel.

#+begin_src java :classname Expression  :results output :exports both
  public class Expression {
      public static void main(String[] args) {
          System.out.println(5 + 6);
      }
  }
#+end_src

#+RESULTS:
: 11 

Is it possible to use Jshell in the org-babel as:

#+begin_src java :classname Anonymous :session java :results output
5 + 6
#+end_src

#+RESULTS:
11 
0

There are 0 best solutions below