caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: forum@x9c.fr
To: caml-list@inria.fr
Cc: John Prevost <j.prevost@gmail.com>, ocamljava@x9c.fr, forum@x9c.fr
Subject: Re: [Caml-list] OCaml-Java 2.0 preview: call for testers
Date: Tue, 14 Aug 2012 20:19:18 +0200	[thread overview]
Message-ID: <20120814201918.11874hfs1aw0ahds@ssl0.ovh.net> (raw)
In-Reply-To: <CALfDbGp6dCrAqcH2DC1iotmCABicsHPPO1K4kW9aHv8Jw4rV5w@mail.gmail.com>

John Prevost <j.prevost@gmail.com> a écrit :

> 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.

Thanks for your detailed report. I have fixed all these issues, and
uploaded a new version of the archive. Would you be kind enough to
test if everything is fixed on your installation too?
The address is the same:
     http://ocamljava.x9c.fr/ocamljava-2.0-early-access.tar.gz


> 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.

Well, I provided no guidance because the current build does not
include the typer extensions allowing to manipulate Java elements
from OCaml code. Such extensions are not complete yet (some tests
are missing, and arrays are not handled yet), and will be integrated
in a future build (hopefully in september).

In the meantime, here is how it works. Some "special" functions behave
as "printf", meaning that their actual type is based on a "format"
string literal. For example,
     Java.make "javax.swing.JButton(java.lang.String,javax.swing.Icon)" (x, y)
will create a "javax.swing.JButton" instance. The OCaml type of the
instance is "javax'swing'JButton java_instance" where "java_instance"
is a particular type whose parameter designates a Java class name
where dots are replaced by simple quote (to fit OCaml syntax).


> Hope these comments help.

They surely do! Thanks again!


Kind regards,

Xavier Clerc


  reply	other threads:[~2012-08-14 18:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-11  2:02 John Prevost
2012-08-14 18:19 ` forum [this message]
  -- 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=20120814201918.11874hfs1aw0ahds@ssl0.ovh.net \
    --to=forum@x9c.fr \
    --cc=caml-list@inria.fr \
    --cc=j.prevost@gmail.com \
    --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).