Classpath problem(?) with NetLogo-Ersatz integration
Hi all, I'm trying to play with NetLogo: http://ccl.northwestern.edu/netlogo/ from Picolisp/Ersatz. I managed to create a working .java with an empty NetLogo model, but am stuck at translating this file to Picolisp. The .java is here: http://stackoverflow.com/questions/24390853/expected-command-error-trying-to-embed-netlogo#24425658 In fact the main problem may be the classpath. Whatever I try in the pil script, adjusting the -cp option to the `java` call, I get this error: java.lang.ClassCastException: PicoLisp$NilSym cannot be cast to PicoLisp$Symbol At this line: (java Import org.nlogo.lite.InterfaceComponent) Is it the right way to do this? Is there something I must know in order to import from a .jar in Ersatz? chri -- http://profgra.org/lycee/ (site pro) http://delicious.com/profgraorg (liens, favoris) https://twitter.com/profgraorg -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: Classpath problem(?) with NetLogo-Ersatz integration
(javaImport org.nlogo.lite.InterfaceComponent) Note the lack of the space in the command javaImport. What may have happened is that the command (java) is invoke with the (null) parameters Import and org.nlogo.lite.InterfaceComponent, hence the error message. Samuel Dennis R. Borlongan On Thu, Jun 26, 2014 at 4:48 PM, Christophe Gragnic < christophegrag...@gmail.com> wrote: > Hi all, > > I'm trying to play with NetLogo: > http://ccl.northwestern.edu/netlogo/ > from Picolisp/Ersatz. > > I managed to create a working .java with an empty NetLogo model, > but am stuck at translating this file to Picolisp. The .java is here: > > http://stackoverflow.com/questions/24390853/expected-command-error-trying-to-embed-netlogo#24425658 > > In fact the main problem may be the classpath. Whatever I try in > the pil script, adjusting the -cp option to the `java` call, I get this > error: > > java.lang.ClassCastException: PicoLisp$NilSym cannot be cast to > PicoLisp$Symbol > > At this line: > > (java Import org.nlogo.lite.InterfaceComponent) > > Is it the right way to do this? > Is there something I must know in order to import from a .jar > in Ersatz? > > > chri > > -- > > http://profgra.org/lycee/ (site pro) > http://delicious.com/profgraorg (liens, favoris) > https://twitter.com/profgraorg > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe >
Re: Classpath problem(?) with NetLogo-Ersatz integration
On Thu, Jun 26, 2014 at 12:57 PM, Samuel Dennis Borlongan wrote: > (javaImport org.nlogo.lite.InterfaceComponent) > > Note the lack of the space in the command javaImport. What may have happened > is that the command (java) is invoke with the (null) parameters Import and > org.nlogo.lite.InterfaceComponent, hence the error message. Thanks for your answer. Now I understand that: * javaImport is not in the official Ersatz, * javaImport is defined in your interop lib: http://picolisp.com/wiki/?javaiterop * the files are here: http://code.google.com/r/srborlongan-picolisp/source/browse#hg%2Fjava What is still unclear: * When running your ersatz/pil, why do I get this: java.lang.UnsupportedClassVersionError: PicoLisp : Unsupported major.minor version 52.0 My guess is that you compiled the .jar with Java > 1.6. How can I use the content of the `java` dir with my old Ersatz? * I tried to load the files in `java` by hand and got a java.lang.reflect.InvocationTargetException, which is said to be a wrapper exception. Any idea about this exception? or a way to unwrap? Thanks. chri -- http://profgra.org/lycee/ (site pro) http://delicious.com/profgraorg (liens, favoris) https://twitter.com/profgraorg -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: Classpath problem(?) with NetLogo-Ersatz integration
Hi Christophe and Samuel, > * When running your ersatz/pil, why do I get this: > java.lang.UnsupportedClassVersionError: PicoLisp : Unsupported > major.minor version 52.0 > My guess is that you compiled the .jar with Java > 1.6. How can I use > the content of the `java` dir with my old Ersatz? You need to install an up-to-date JDK, and then $ cd ersatz $ ./mkJar ♪♫ Alex -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: Classpath problem(?) with NetLogo-Ersatz integration
On Thu, Jun 26, 2014 at 02:58:21PM +0200, Alexander Burger wrote: >$ cd ersatz >$ ./mkJar Oops, this is a kind of chick-egg problem :) 'mkJar' calls the local 'pil' in that directory, which in turn is based on ErsatzLisp. So if there is no executable version of ErsatzLisp, you should be able to change the first line of 'mkJar' to call some existing instance of PicoLisp (e.g. "#!/usr/bin/pil"). ♪♫ Alex -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: Classpath problem(?) with NetLogo-Ersatz integration
Thanks. I'm making progress, but I can't figure out how the interop files in the java dir are loaded in Samuel's version. What I do for now is to manually append the files to the `pil` call. I'd like to understand and use the proper way ! -- http://profgra.org/lycee/ (site pro) http://delicious.com/profgraorg (liens, favoris) https://twitter.com/profgraorg -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: Classpath problem(?) with NetLogo-Ersatz integration
Try replacing the picolisp.jar file with the mainline jar. What I usually do is to call mkJar with the original jar, which then builds my version. The problem with my version of the jar is that I've been running Java 8 since the beta existed 6 months ago, so every time I cal mkJarWin, the resulting jar only works in Java 8. Apologies. Samuel Dennis R. Borlongan On Thu, Jun 26, 2014 at 9:55 PM, Christophe Gragnic < christophegrag...@gmail.com> wrote: > Thanks. > I'm making progress, but I can't figure out how the interop files > in the java dir are loaded in Samuel's version. What I do for now > is to manually append the files to the `pil` call. > I'd like to understand and use the proper way ! > > -- > > http://profgra.org/lycee/ (site pro) > http://delicious.com/profgraorg (liens, favoris) > https://twitter.com/profgraorg > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe >
Re: Classpath problem(?) with NetLogo-Ersatz integration
On Thu, Jun 26, 2014 at 5:54 PM, Samuel Dennis Borlongan wrote: > Try replacing the picolisp.jar file with the mainline jar. > > What I usually do is to call mkJar with the original jar, which then builds > my version. > > The problem with my version of the jar is that I've been running Java 8 > since the beta existed 6 months ago, so every time I cal mkJarWin, the > resulting jar only works in Java 8. Thanks Samuel. I managed to build the .jar using a C/ASM Picolisp (irony!) but my problem is that I don't understand how to use your interop lib: how to load the files in your java dir? When I call ersatz/pil, javaImport is still NIL. I guess I'm missing something obvious. chri -- http://profgra.org/lycee/ (site pro) http://delicious.com/profgraorg (liens, favoris) https://twitter.com/profgraorg -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: Classpath problem(?) with NetLogo-Ersatz integration
You woud need to (load "@java/java+.l)" to load all the java interoperability functions. Question to the audience: should I then add said function to the ersatz launch script as part of the changes? How do I add it to pil? Another question to the audience: I could replace my jar with the mainline jar, then advice users to mkJar so that they get a jar file containing my changes. Is it advisable? (As you may notice, I may be at least five years younger than you.) Samuel Dennis R. Borlongan On Fri, Jun 27, 2014 at 3:19 AM, Christophe Gragnic < christophegrag...@gmail.com> wrote: > On Thu, Jun 26, 2014 at 5:54 PM, Samuel Dennis Borlongan > wrote: > > Try replacing the picolisp.jar file with the mainline jar. > > > > What I usually do is to call mkJar with the original jar, which then > builds > > my version. > > > > The problem with my version of the jar is that I've been running Java 8 > > since the beta existed 6 months ago, so every time I cal mkJarWin, the > > resulting jar only works in Java 8. > > Thanks Samuel. I managed to build the .jar using a C/ASM Picolisp > (irony!) but my problem is that I don't understand how to use your > interop lib: how to load the files in your java dir? > When I call ersatz/pil, javaImport is still NIL. > I guess I'm missing something obvious. > > > chri > > -- > > http://profgra.org/lycee/ (site pro) > http://delicious.com/profgraorg (liens, favoris) > https://twitter.com/profgraorg > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe >
Subscribe
Hello Enrique =?iso-8859-1?Q?S=E1nchez?= :-) You are now subscribed -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: Classpath problem(?) with NetLogo-Ersatz integration
I have now added the ersatz enhancements library to ersatz/pil, and replaced the jar in my branch with mainline (users will now have to mkJar to have a version that has the enhancements). Samuel Dennis R. Borlongan On Fri, Jun 27, 2014 at 8:16 AM, Samuel Dennis Borlongan < srborlon...@gmail.com> wrote: > You woud need to (load "@java/java+.l)" to load all the java > interoperability functions. > > Question to the audience: should I then add said function to the ersatz > launch script as part of the changes? How do I add it to pil? > Another question to the audience: I could replace my jar with the mainline > jar, then advice users to mkJar so that they get a jar file containing my > changes. Is it advisable? > > (As you may notice, I may be at least five years younger than you.) > > Samuel Dennis R. Borlongan > > > On Fri, Jun 27, 2014 at 3:19 AM, Christophe Gragnic < > christophegrag...@gmail.com> wrote: > >> On Thu, Jun 26, 2014 at 5:54 PM, Samuel Dennis Borlongan >> wrote: >> > Try replacing the picolisp.jar file with the mainline jar. >> > >> > What I usually do is to call mkJar with the original jar, which then >> builds >> > my version. >> > >> > The problem with my version of the jar is that I've been running Java 8 >> > since the beta existed 6 months ago, so every time I cal mkJarWin, the >> > resulting jar only works in Java 8. >> >> Thanks Samuel. I managed to build the .jar using a C/ASM Picolisp >> (irony!) but my problem is that I don't understand how to use your >> interop lib: how to load the files in your java dir? >> When I call ersatz/pil, javaImport is still NIL. >> I guess I'm missing something obvious. >> >> >> chri >> >> -- >> >> http://profgra.org/lycee/ (site pro) >> http://delicious.com/profgraorg (liens, favoris) >> https://twitter.com/profgraorg >> -- >> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe >> > >
Re: Classpath problem(?) with NetLogo-Ersatz integration
Hi Samuel (and others reading!), On Fri, Jun 27, 2014 at 2:16 AM, Samuel Dennis Borlongan wrote: > You woud need to (load "@java/java+.l)" to load all the java > interoperability functions. Thanks. > Question to the audience: should I then add said function to the ersatz > launch script as part of the changes? How do I add it to pil? > Another question to the audience: I could replace my jar with the mainline > jar, then advice users to mkJar so that they get a jar file containing my > changes. Is it advisable? Launch script loading the lib: This could be nice for the user. Replace the .jar: Why not. Or provide both with some instructions. On Fri, Jun 27, 2014 at 4:11 AM, Samuel Dennis Borlongan wrote: > I have now added the ersatz enhancements library to ersatz/pil, and replaced > the jar in my branch with mainline (users will now have to mkJar to have a > version that has the enhancements). Great ! There is a problem with the path though. BTW, is there a good reason for the `java` dir not to be in the `ersatz` dir? /opt/srborlongan-picolisp $ ersatz/pil "@java/java+.l" -- Read open error /opt/srborlongan-picolisp $ mv java ersatz /opt/srborlongan-picolisp $ ersatz/pil : javaVersion -> (("Print?") ("javaVersion" "Print?")) : (bye) chri -- http://profgra.org/lycee/ (site pro) http://delicious.com/profgraorg (liens, favoris) https://twitter.com/profgraorg -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe