* [babel] ob-java error org-babel-execute-src-block: Wrong type argument: characterp, "-cp ."
@ 2012-08-07 8:17 Torsten Wagner
2012-08-07 8:59 ` Torsten Wagner
2012-08-07 14:01 ` Eric Schulte
0 siblings, 2 replies; 4+ messages in thread
From: Torsten Wagner @ 2012-08-07 8:17 UTC (permalink / raw
To: Org Mode Mailing List
Hi all,
every year I want like to evaluate java snippets in org-mode to
evaluate courseworks.
This worked fine but recently I had a bigger data crash and re-setup
my office machine.
It worked ok for the crash (that is it worked ok for the set-up at that time).
I use now
GNU Emacs 24.1.1
Org-mode version 7.8.11
I can evaluate simpler blocks but for more complex once I run into trouble
I used
#+BABEL: :mkdirp t
#+BABEL: :cmpflag -cp .
#+BABEL: :cmdline -cp .
#+begin_src emacs-lisp
(setq org-babel-default-header-args:java '((:cmpflag "-cp .")
(:cmdline "-cp .")))
#+end_src
** CODE-TESTER
#+BEGIN_SRC java :classname enshu4/Shop4Tester
package enshu4;
public class Shop4Tester {
public static void main(String[] args) {
System.out.println("----------Checking for list 1---------");
Shop4 shop1 = new Shop4("item1.txt");
shop1.print("potato");
shop1.printAllNames();
System.out.println("\n----------Checking for list 2----------");
Shop4 shop2 = new Shop4("item2.txt");
shop2.print("potato");
shop2.printAllNames();
}
}
#+END_SRC
** studentID
#+BEGIN_SRC java :classname enshu4/Shop4
package enshu4;
import java.util.Hashtable;
import java.util.Iterator;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.FileNotFoundException;
public class Shop4 {
private Hashtable<String, Integer> item;
public void printAllNames() {
String tes;
Iterator<String> it = item.keySet().iterator();
while (it.hasNext()) {
tes = it.next();
System.out.println(tes + " a " + item.get(tes) + "Euro");
}
}
public Shop4(String fname) {
item = new Hashtable<String,Integer>();
FileReader fr;
try {
fr = new FileReader(fname);
} catch (FileNotFoundException e) {
System.out.println(fname + "not found");
return;
}
BufferedReader br = new BufferedReader(fr);
String line;
try {
while ((line = br.readLine()) != null) {
String target = line;
String[] splt = target.split("=");
String key = splt[0];
String val = splt[1];
item.put(key,new Integer(val));
}
br.close();
} catch (IOException e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
Shop4 shop = new Shop4("item.txt");
shop.printAllNames();
}
}
#+END_SRC
If I want to execute the given source code block I end up with an error message
org-babel-execute-src-block: Wrong type argument: characterp, "-cp ."
I believe this is rather common due to some changes within emacs, but
I can't find a way to get around this.
Any idea?
BTW. previous year it seems I created the lists by
#+BEGIN_SRC text :tangle ./item1.txt
potato=120
bread=160
milk=180
#+END_SRC
but this seems not to work anymore.... anyhow that would be a minor problem
Thanks for looking into this.
Torsten
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [babel] ob-java error org-babel-execute-src-block: Wrong type argument: characterp, "-cp ."
2012-08-07 8:17 [babel] ob-java error org-babel-execute-src-block: Wrong type argument: characterp, "-cp ." Torsten Wagner
@ 2012-08-07 8:59 ` Torsten Wagner
2012-08-07 14:01 ` Eric Schulte
1 sibling, 0 replies; 4+ messages in thread
From: Torsten Wagner @ 2012-08-07 8:59 UTC (permalink / raw
To: Org Mode Mailing List
Seems like I can get around it....
#+begin_src emacs-lisp
(setq org-babel-default-header-args:java '((:cmpflag "-cp .")(:cmdline
"-cp .")))
#+end_src
This creates problems however, it is not needed anymore
Will try a bit more and report
Torsten
On 7 August 2012 17:17, Torsten Wagner <torsten.wagner@gmail.com> wrote:
> Hi all,
>
> every year I want like to evaluate java snippets in org-mode to
> evaluate courseworks.
> This worked fine but recently I had a bigger data crash and re-setup
> my office machine.
> It worked ok for the crash (that is it worked ok for the set-up at that time).
>
> I use now
>
> GNU Emacs 24.1.1
> Org-mode version 7.8.11
>
> I can evaluate simpler blocks but for more complex once I run into trouble
> I used
>
> #+BABEL: :mkdirp t
> #+BABEL: :cmpflag -cp .
> #+BABEL: :cmdline -cp .
>
> #+begin_src emacs-lisp
> (setq org-babel-default-header-args:java '((:cmpflag "-cp .")
> (:cmdline "-cp .")))
> #+end_src
>
>
> ** CODE-TESTER
> #+BEGIN_SRC java :classname enshu4/Shop4Tester
> package enshu4;
> public class Shop4Tester {
> public static void main(String[] args) {
> System.out.println("----------Checking for list 1---------");
> Shop4 shop1 = new Shop4("item1.txt");
> shop1.print("potato");
> shop1.printAllNames();
>
> System.out.println("\n----------Checking for list 2----------");
> Shop4 shop2 = new Shop4("item2.txt");
> shop2.print("potato");
> shop2.printAllNames();
> }
> }
> #+END_SRC
>
>
> ** studentID
> #+BEGIN_SRC java :classname enshu4/Shop4
> package enshu4;
>
> import java.util.Hashtable;
> import java.util.Iterator;
> import java.io.BufferedReader;
> import java.io.FileReader;
> import java.io.IOException;
> import java.io.FileNotFoundException;
>
> public class Shop4 {
> private Hashtable<String, Integer> item;
>
> public void printAllNames() {
> String tes;
> Iterator<String> it = item.keySet().iterator();
> while (it.hasNext()) {
> tes = it.next();
> System.out.println(tes + " a " + item.get(tes) + "Euro");
> }
> }
>
> public Shop4(String fname) {
> item = new Hashtable<String,Integer>();
> FileReader fr;
> try {
> fr = new FileReader(fname);
> } catch (FileNotFoundException e) {
> System.out.println(fname + "not found");
> return;
> }
>
> BufferedReader br = new BufferedReader(fr);
> String line;
>
> try {
> while ((line = br.readLine()) != null) {
> String target = line;
> String[] splt = target.split("=");
> String key = splt[0];
> String val = splt[1];
> item.put(key,new Integer(val));
> }
> br.close();
> } catch (IOException e) {
> e.printStackTrace();
> }
> }
>
> public static void main(String[] args) {
> Shop4 shop = new Shop4("item.txt");
> shop.printAllNames();
> }
> }
> #+END_SRC
>
> If I want to execute the given source code block I end up with an error message
>
> org-babel-execute-src-block: Wrong type argument: characterp, "-cp ."
>
>
> I believe this is rather common due to some changes within emacs, but
> I can't find a way to get around this.
>
> Any idea?
>
>
> BTW. previous year it seems I created the lists by
>
> #+BEGIN_SRC text :tangle ./item1.txt
> potato=120
> bread=160
> milk=180
> #+END_SRC
>
> but this seems not to work anymore.... anyhow that would be a minor problem
>
>
> Thanks for looking into this.
>
> Torsten
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [babel] ob-java error org-babel-execute-src-block: Wrong type argument: characterp, "-cp ."
2012-08-07 8:17 [babel] ob-java error org-babel-execute-src-block: Wrong type argument: characterp, "-cp ." Torsten Wagner
2012-08-07 8:59 ` Torsten Wagner
@ 2012-08-07 14:01 ` Eric Schulte
2012-08-08 3:16 ` Torsten Wagner
1 sibling, 1 reply; 4+ messages in thread
From: Eric Schulte @ 2012-08-07 14:01 UTC (permalink / raw
To: Torsten Wagner; +Cc: Org Mode Mailing List
Torsten Wagner <torsten.wagner@gmail.com> writes:
> Hi all,
>
> every year I want like to evaluate java snippets in org-mode to
> evaluate courseworks.
> This worked fine but recently I had a bigger data crash and re-setup
> my office machine.
> It worked ok for the crash (that is it worked ok for the set-up at that time).
>
> I use now
>
> GNU Emacs 24.1.1
> Org-mode version 7.8.11
>
> I can evaluate simpler blocks but for more complex once I run into trouble
> I used
>
> #+BABEL: :mkdirp t
> #+BABEL: :cmpflag -cp .
> #+BABEL: :cmdline -cp .
>
The above should use standard property lines, see (info "(org)Buffer-wide header arguments")
>
> #+begin_src emacs-lisp
> (setq org-babel-default-header-args:java '((:cmpflag "-cp .")
> (:cmdline "-cp .")))
> #+end_src
>
This seems to me to be redundant with the above. No need to set these
for the language and the buffer.
Best,
>
>
> ** CODE-TESTER
> #+BEGIN_SRC java :classname enshu4/Shop4Tester
> package enshu4;
> public class Shop4Tester {
> public static void main(String[] args) {
> System.out.println("----------Checking for list 1---------");
> Shop4 shop1 = new Shop4("item1.txt");
> shop1.print("potato");
> shop1.printAllNames();
>
> System.out.println("\n----------Checking for list 2----------");
> Shop4 shop2 = new Shop4("item2.txt");
> shop2.print("potato");
> shop2.printAllNames();
> }
> }
> #+END_SRC
>
>
> ** studentID
> #+BEGIN_SRC java :classname enshu4/Shop4
> package enshu4;
>
> import java.util.Hashtable;
> import java.util.Iterator;
> import java.io.BufferedReader;
> import java.io.FileReader;
> import java.io.IOException;
> import java.io.FileNotFoundException;
>
> public class Shop4 {
> private Hashtable<String, Integer> item;
>
> public void printAllNames() {
> String tes;
> Iterator<String> it = item.keySet().iterator();
> while (it.hasNext()) {
> tes = it.next();
> System.out.println(tes + " a " + item.get(tes) + "Euro");
> }
> }
>
> public Shop4(String fname) {
> item = new Hashtable<String,Integer>();
> FileReader fr;
> try {
> fr = new FileReader(fname);
> } catch (FileNotFoundException e) {
> System.out.println(fname + "not found");
> return;
> }
>
> BufferedReader br = new BufferedReader(fr);
> String line;
>
> try {
> while ((line = br.readLine()) != null) {
> String target = line;
> String[] splt = target.split("=");
> String key = splt[0];
> String val = splt[1];
> item.put(key,new Integer(val));
> }
> br.close();
> } catch (IOException e) {
> e.printStackTrace();
> }
> }
>
> public static void main(String[] args) {
> Shop4 shop = new Shop4("item.txt");
> shop.printAllNames();
> }
> }
> #+END_SRC
>
> If I want to execute the given source code block I end up with an error message
>
> org-babel-execute-src-block: Wrong type argument: characterp, "-cp ."
>
>
> I believe this is rather common due to some changes within emacs, but
> I can't find a way to get around this.
>
> Any idea?
>
>
> BTW. previous year it seems I created the lists by
>
> #+BEGIN_SRC text :tangle ./item1.txt
> potato=120
> bread=160
> milk=180
> #+END_SRC
>
> but this seems not to work anymore.... anyhow that would be a minor problem
>
>
> Thanks for looking into this.
>
> Torsten
>
--
Eric Schulte
http://cs.unm.edu/~eschulte
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [babel] ob-java error org-babel-execute-src-block: Wrong type argument: characterp, "-cp ."
2012-08-07 14:01 ` Eric Schulte
@ 2012-08-08 3:16 ` Torsten Wagner
0 siblings, 0 replies; 4+ messages in thread
From: Torsten Wagner @ 2012-08-08 3:16 UTC (permalink / raw
To: Eric Schulte; +Cc: Org Mode Mailing List
Hi Eric,
AAAAAARRRRGGGHHHH.... now I remember I participated in that discussion
to replace #+BABEL by #+PROPERTY.....
that is the pitfall if you reuse stuff only once a year and heavy
development goes on in the mean time ;)
Thanks for the reminder and yeah now all works out ok.
Just as a note to myself and maybe others who read this...
#+PROPERTY: :mkdirp t
#+PROPERTY: :cmpflag -cp .
#+PROPERTY: :cmdline -cp .
This is what is needed to set the flags for the java environment
#+BEGIN_SRC text :tangle ./item1.txt
A
B
C
#+END_SRC
This blocks allow you to TANGLE files which you might need to test
your code (simulate input etc.)
The problem here... you need to TANGLE them... NOT execute them.
So now it works again. The problem was a PEBKAC...
Thanks Eric
Torsten
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-08-08 3:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-07 8:17 [babel] ob-java error org-babel-execute-src-block: Wrong type argument: characterp, "-cp ." Torsten Wagner
2012-08-07 8:59 ` Torsten Wagner
2012-08-07 14:01 ` Eric Schulte
2012-08-08 3:16 ` Torsten Wagner
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.