From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by sympa.inria.fr (Postfix) with ESMTPS id BDA117ED67 for ; Tue, 14 Aug 2012 20:19:19 +0200 (CEST) Received-SPF: None (mail1-smtp-roc.national.inria.fr: no sender authenticity information available from domain of forum@x9c.fr) identity=pra; client-ip=46.105.56.136; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="forum@x9c.fr"; x-sender="forum@x9c.fr"; x-conformance=sidf_compatible Received-SPF: Pass (mail1-smtp-roc.national.inria.fr: domain of forum@x9c.fr designates 46.105.56.136 as permitted sender) identity=mailfrom; client-ip=46.105.56.136; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="forum@x9c.fr"; x-sender="forum@x9c.fr"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail1-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mo6.mail-out.ovh.net) identity=helo; client-ip=46.105.56.136; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="forum@x9c.fr"; x-sender="postmaster@mo6.mail-out.ovh.net"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AisCAI2VKlAuaTiIgWdsb2JhbABFuj4BARYmJ4IgAQEEAR1cBQsLRiEoAQ0Zh34DBgoHr0INiU6KIYcVA5N4gVIBgRQIiW6HZw X-IronPort-AV: E=Sophos;i="4.77,768,1336341600"; d="scan'208";a="169891237" Received: from 1.mo6.mail-out.ovh.net (HELO mo6.mail-out.ovh.net) ([46.105.56.136]) by mail1-smtp-roc.national.inria.fr with ESMTP; 14 Aug 2012 20:19:19 +0200 Received: from mail391.ha.ovh.net (b7.ovh.net [213.186.33.57]) by mo6.mail-out.ovh.net (Postfix) with SMTP id 4A059FF8415 for ; Tue, 14 Aug 2012 20:24:40 +0200 (CEST) Received: from b0.ovh.net (HELO queueout) (213.186.33.50) by b0.ovh.net with SMTP; 14 Aug 2012 18:19:18 -0000 Received: from ns0.ovh.net (HELO localhost) (213.186.33.20) by ns0.ovh.net with SMTP; 14 Aug 2012 18:19:18 -0000 Received: from ip-131.net-82-216-20.versailles2.rev.numericable.fr (ip-131.net-82-216-20.versailles2.rev.numericable.fr [82.216.20.131]) by ssl0.ovh.net (Horde Framework) with HTTP; Tue, 14 Aug 2012 20:19:18 +0200 Message-ID: <20120814201918.11874hfs1aw0ahds@ssl0.ovh.net> Date: Tue, 14 Aug 2012 20:19:18 +0200 From: forum@x9c.fr To: caml-list@inria.fr Cc: John Prevost , ocamljava@x9c.fr, forum@x9c.fr X-Ovh-Mailout: 178.32.228.6 (mo6.mail-out.ovh.net) References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; DelSp="Yes"; format="flowed" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable User-Agent: Internet Messaging Program (IMP) H3 (4.3.5) X-Ovh-Tracer-Id: 10855363952018195232 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeehtddrtdegucetufdoteggodetrfcurfhrohhfihhlvgemucfqggfjnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfhrhhomhepfhhorhhumhesgieltgdrfhhrnecuffhomhgrihhnpeiglegtrdhfrhenucfjughrpefhvffufhgjgggtugfgfgesthhqtddttderud Subject: Re: [Caml-list] OCaml-Java 2.0 preview: call for testers John Prevost a =E9crit=A0: > 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