caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: John Prevost <j.prevost@gmail.com>
To: ocamljava@x9c.fr
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] OCaml-Java 2.0 preview: call for testers
Date: Fri, 10 Aug 2012 22:02:19 -0400	[thread overview]
Message-ID: <CALfDbGp6dCrAqcH2DC1iotmCABicsHPPO1K4kW9aHv8Jw4rV5w@mail.gmail.com> (raw)

Tried this out on Windows under cygwin and had a couple of problems.
CCing caml-list in case anybody else has run into similar.

1) There's some special code in bin/common to check for cygwin and use
cygpath to convert JAVA_HOME to a UNIX-style path.  That works...
except in the case that there's a space in the path (which there
almost certainly is on Windows).  Each of the scripts (bin/ocaml
bin/ocamljava, etc.) should use "$OCJ_JAVA" instead of $OCJ_JAVA (that
is: quote the variable so that spaces aren't interpreted as separate
tokens).  With this change, the scripts call Java correctly.

1a) It might be appropriate to see if "java" is on the path and try to
use that if JAVA_HOME is not set (as it was not on my machine).  The
batch files appear to do this already (and quote %OCJ_JAVA%, as well.)

2) With that change, ocamljava still didn't run right away.  It
appears to be because it's trying to parse the CLASSPATH environment
variable, but it's using UNIX rules to do so.  Since I don't know
what's going on inside, I can't say exactly why, but I can report the
error message:

File "test.ml", line 1, characters 0-1:
Error: Classpath error: ".;C" does not exist

(This happens with whatever input is provided to ocamljava.)

Two things here:

2a) It's interpreting the CLASSPATH as using : as a separator, whereas
it's actually using ; as a separator.  So, it sees ".;C:\..." and
thinks the first segment is ".;C"

2b) Even though it's interpreting the CLASSPATH wrong, it probably
still should not be an error for the CLASSPATH to contain paths that
do not exist.  Those should be ignored, rather than triggering an
error.

Finally, even though a stated goal is to be able to use Java's
libraries from OCaml code, there doesn't seem to be any documentation
on how to actually do that.  I tried using external just in case, but
if that's the mechanism I'm not sure how it's meant to be used.  A
little guidance on how to call into Java from OCaml would be
appreciated.  This would be helpful both to test that it works
correctly and to figure out if the abstraction that's provided is
adequate.

Hope these comments help.

John Prevost.

             reply	other threads:[~2012-08-11  2:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-11  2:02 John Prevost [this message]
2012-08-14 18:19 ` forum
  -- strict thread matches above, loose matches on Subject: below --
2012-08-02 15:21 forum

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CALfDbGp6dCrAqcH2DC1iotmCABicsHPPO1K4kW9aHv8Jw4rV5w@mail.gmail.com \
    --to=j.prevost@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=ocamljava@x9c.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).