[armedbear-devel] Several ABCL/Java questions
alessiostalla at gmail.com
Tue Jan 4 11:36:43 UTC 2011
On Tue, Jan 4, 2011 at 12:20 PM, Didier Verna <didier at lrde.epita.fr> wrote:
> Hi Alessio, thanks for your reply.
> Alessio Stalla <alessiostalla at gmail.com> wrote:
>>> 1/ Is it possible to create standalone ABCL executables and how ?
>> I'd say no, but it really depends on what you mean. You can't create
>> standalone executables in Java, the equivalent is a bunch of Jar files
>> (for console or GUI applications). It is possible to package ABCL +
>> your software as a bunch of Jar files, but ABCL doesn't provide
>> facilities of its own for that, though it's not hard to do (you can
>> look at ABCL's own build script to get an idea). ABCL has no
>> facilities for dumping a memory image, either (memory being controlled
>> by the JVM makes this hard).
> OK, so here's where I am right now: Clon is a command-line option
> parser library so it's essentially targetted at standalone executables.
> However, I see that you can do something like that:
> java -jar myapp.jar --myapp-opt-1 --myapp-other-opt ...
> and get the command-line arguments from *command-line-argument-list* so
> it probably still makes sense to port Clon to ABCL. The next question
> is: how do I hook an initial "main" function into myapp.jar. I seem to
> remember that you need a Main class in Java, but I'm not sure about the
> Lisp level.
You do need one. You can either use ABCL's one - in that case you have
to pass something like --eval "(your-main-function)", perhaps with a
shell script - or write a custom one in Java that will call the right
>>> 2/ ABCL doesn't seem to provide a [set|put]env function.
>> I'd say yes, it's correct. But what are you trying to achieve? If you
>> want to provide an environment for a subprocess, the ProcessBuilder
>> class supports it. If you want to modify your own environment, you
>> can't (without resorting to FFI, as far as I know), but why do you
>> want to do that?
> In Clon, command-line options may be associated with environment
> variables providing implicit values. In case such a variable contains a
> typo (for instance DEBUG=ys instead of DEBUG=yes), Clon provides a
> restart for fixing that interactively, which can benefit to the current
> process but also subsequent ones launched from the same terminal. I
> guess I can just disable this restart in the ABCL version.
Ok, yes you can disable it, or implement it by calling an external
command to set the variable (that will only be seen by subsequent
>>> 4/ There is a place where I need to access low-level information
>>> about a stream
>> I don't know. ABCL streams wrap java.io streams and readers/writers
>> and I don't think there's a mean of accessing their low-level
>> implementation. Perhaps with a dedicated library that uses JNI/JNA and
>> provides custom streams, but I don't know any. Terminal handling is
>> not common in Java (as most OS-specific stuff).
> OK :-/
In fact, I think a lot of criticism Lisp receives for not being
integrated enough with the OS, etc. would apply twice as much for
Java, yet nobody seems to notice :P
More information about the armedbear-devel