Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[Caml-list] [ANN] OCaml-Java project : beta version

12 views
Skip to first unread message

fo...@x9c.fr

unread,
Mar 1, 2008, 6:47:01 AM3/1/08
to caml...@yquem.inria.fr
This post announces the beta release of the OCaml-Java project.
The goal of the OCaml-Java project is to allow seamless integration of
OCaml and Java.
Home page: http://ocamljava.x9c.fr

This version features a new binary distribution that is packed with
all you need to run
OCaml programs on a JVM. This distribution does not even need the
standard Objective
Caml distribution to be installed on your computer.
URL: http://ocamljava.x9c.fr/downloads.html


All the subprojects of OCaml-Java have of course been updated.
A detailed changelog from the initial alpha release to the new beta
release follows.

Barista subproject:
- minor API changes
- minor grammar changes
- Java API

Cadmium subproject:
- scripting support
- XML support
- file hooks / embedded mode
- toplevel enhancements
- fr.x9c.cadmium.support.values for easy encoding of OCaml values
- SPI support

Cafesterol subproject:
- scripting support
- standalone linking mode
- servlet support

Nickel subproject:
- support for 'meta' tags

OCamlScripting subproject:
- standalone version

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Adrien

unread,
Mar 1, 2008, 2:03:27 PM3/1/08
to fo...@x9c.fr, caml...@yquem.inria.fr
Hi,

I am running under Vista right now (this is unusual for me). This
computer does not have ocaml installed, nor cygwin, mingw, msys or
msvc. The only related program it has is java 1.6. However the same
happens under winXP.

In a command prompt if I run "javaw ocaml.jar", I get a graphical
message box telling me :
Java Virtual Machine Launcher
---------------------------
Could not find the main class. Program will exit.

If I rather run "java ocaml.jar", the error message is:
Exception in thread "main" java.lang.NoClassDefFoundError: ocaml/jar


I've seen in your roadmap you have to port it to java 1.6. Does it
mean that meanwhile it is absolutely impossible to run ocamljava with
java6 ?

Thanks.


PS : by the way, your ocaml repl works really nicely ; I've used it
under internet explorer, k-meleon, opera, firefox, xp or vista (only
k-meleon and ie then) but not linux as I usually don't have the jvm.
It has been useful several times. Thanks. :)

---

Adrien Nader

Adrien

unread,
Mar 1, 2008, 3:01:26 PM3/1/08
to caml...@yquem.inria.fr
David Allsopp just pointed to me my command-line was incorrect. It
lacked the -jar switch :
java -jar ocaml.jar

Thanks a lot !


However one has to note it is not possible to use javaw : it returns
immediately and here immediately really means immediately, faster than
a java program can start.

Now about ocamljava, ocaml.jar immediately exits with "unable to
locate ocaml toplevel". I thought it did not need ocaml(.out).

Also, ocamljava.jar has another problem :
java -jar bin\ocamljava.jar
Fatal error: exception
Sys_error("/usr/local/share/camomile/database/general_cat
egory.mar: java.io.IOException: file does not exist:
\usr\local\share\camomile\
database\general_category.mar")


Thanks for your work.

Richard Jones

unread,
Mar 1, 2008, 5:51:38 PM3/1/08
to caml...@inria.fr
I should add that there's a Fedora tracking bug for ocamljava where
(if you have Fedora or Red Hat Enterprise Linux) you can play with the
previous alpha version:

https://bugzilla.redhat.com/show_bug.cgi?id=434560

I was working on the beta version today but didn't quite get it going.
When I do it'll appear in the above tracking bug.

Rich.

--
Richard Jones
Red Hat

fo...@x9c.fr

unread,
Mar 2, 2008, 5:46:26 AM3/2/08
to caml...@yquem.inria.fr

Le 1 mars 08 à 20:03, Adrien a écrit :

> Hi,
>
> I am running under Vista right now (this is unusual for me). This
> computer does not have ocaml installed, nor cygwin, mingw, msys or
> msvc. The only related program it has is java 1.6. However the same
> happens under winXP.
>
> In a command prompt if I run "javaw ocaml.jar", I get a graphical
> message box telling me :
> Java Virtual Machine Launcher
> ---------------------------
> Could not find the main class. Program will exit.
>
> If I rather run "java ocaml.jar", the error message is:
> Exception in thread "main" java.lang.NoClassDefFoundError: ocaml/jar

You should rather run "java -jar ocaml.jar".
I was not aware of the existence of a "javaw" utility; it is a Windows-
only thing ?


> I've seen in your roadmap you have to port it to java 1.6. Does it
> mean that meanwhile it is absolutely impossible to run ocamljava with
> java6 ?

No, ocamljava should run on any 1.5+ JVM provided that:
- JVMs remains backward compatible (this should be the case, as a Sun
policy)
- there is no ocamljava-related bug that show up only on later JVMs

The roadmap mentions a move from Java 1.5 to Java 1.6; it will induce
producing
Java 1.6 bytecode and giving up 1.5 compatibility. This should
hopefully make
ocamljava a little faster, notably at startup where 1.6-introduced
stack frames should
have some impact.


> PS : by the way, your ocaml repl works really nicely ; I've used it
> under internet explorer, k-meleon, opera, firefox, xp or vista (only
> k-meleon and ie then) but not linux as I usually don't have the jvm.
> It has been useful several times. Thanks. :)

Thanks for the testing.
I did not mention it in my previous post but the beta update features
some
toplevel enhancements such as the access to session history, as well
as the
ability to save this history to a file.


Xavier Clerc

fo...@x9c.fr

unread,
Mar 2, 2008, 5:52:43 AM3/2/08
to Richard Jones, caml...@inria.fr

Le 1 mars 08 à 23:51, Richard Jones a écrit :

> I should add that there's a Fedora tracking bug for ocamljava where
> (if you have Fedora or Red Hat Enterprise Linux) you can play with the
> previous alpha version:
>
> https://bugzilla.redhat.com/show_bug.cgi?id=434560
>
> I was working on the beta version today but didn't quite get it going.
> When I do it'll appear in the above tracking bug.

A public thank to Richard for this piece of work.
I will try to assist him in the move to beta, and make ocamljava as
easy to package as possible.

By the way, could anyone point some resources/tutorials about
Fedora packaging. I am a regular <Unix/Linux> shell user but,
my machine of choice being MacOS-based, I have no experience
in creating (or even using) packages.
Thanks for any pointer.


Xavier Clerc

fo...@x9c.fr

unread,
Mar 2, 2008, 5:53:35 AM3/2/08
to caml...@yquem.inria.fr

Le 1 mars 08 à 21:01, Adrien a écrit :

>
> Now about ocamljava, ocaml.jar immediately exits with "unable to
> locate ocaml toplevel". I thought it did not need ocaml(.out).
>
> Also, ocamljava.jar has another problem :
> java -jar bin\ocamljava.jar
> Fatal error: exception
> Sys_error("/usr/local/share/camomile/database/general_cat
> egory.mar: java.io.IOException: file does not exist:
> .\usr\local\share\camomile\
> database\general_category.mar")

Well, I have to admit that I made some errors while crafting the
binary package.
I just fixed them and uploaded a new version (check out http://ocamljava.x9c.fr/downloads.html)
.
You should now be able to use the various tools. Here is a short test
session assuming you
have a "source.ml" file (typical content: <<let () = List.iter
print_endline ["hello ..."; "... world"]>>):

Execution of toplevel:
java -jar ocaml.jar

Compilation to OCaml bytecode:
java -jar ocamlc.jar -o bc source.ml
Execution of produced btyecode:
java -jar ocamlrun.jar bc

Compilation to Java jar file:
java -jar ocamljava.jar -standalone -o prog.jar source.ml
Execution of produced jar file:
java -jar prog.jar


However, I noticed a bug with the binary package that does not show up
if you have
the standard OCaml distribution installed on your computer: the
ocamlc.jar/ocamljava.jar
compilers will fail if the current directory contains the by-product
of a previous compilation
(e.g. cmo or cmi files). The temporary workaround is to delete these
files before any
compilation.

I suspect this bug has something to do with the embedded mode (the
ability for the
Java-run programs to look for files inside their jar files rather than
on the local file
system). I will hunt this bug and report to the list when it is fixed.
Sorry for the inconvenience in the meanwhile.


Xavier Clerc

Richard Jones

unread,
Mar 2, 2008, 7:26:56 AM3/2/08
to fo...@x9c.fr, caml...@inria.fr
On Sun, Mar 02, 2008 at 11:52:18AM +0100, fo...@x9c.fr wrote:
> By the way, could anyone point some resources/tutorials about
> Fedora packaging. I am a regular <Unix/Linux> shell user but,
> my machine of choice being MacOS-based, I have no experience
> in creating (or even using) packages.

You'll want to start with an introduction to RPM:

http://wiki.rpm.org/Docs
http://docs.fedoraproject.org/drafts/rpm-guide-en/

This walks you through building one:

http://fedoraproject.org/wiki/Docs/Drafts/BuildingPackagesGuide

Fedora has specific guidelines:

http://fedoraproject.org/wiki/Packaging/Guidelines
http://fedoraproject.org/wiki/Packaging/OCaml

In the interests of fair 'n' balanced reporting, here are the
equivalent Debian docs:

http://www.debian.org/doc/FAQ/ch-pkgtools.en.html
http://www.debian.org/doc/debian-policy/
http://pkg-ocaml-maint.alioth.debian.org/
http://pkg-ocaml-maint.alioth.debian.org/ocaml_packaging_policy.html/index.html

Rich.

--
Richard Jones
Red Hat

_______________________________________________

Florian Weimer

unread,
Mar 2, 2008, 3:39:04 PM3/2/08
to fo...@x9c.fr, caml...@yquem.inria.fr
> I was not aware of the existence of a "javaw" utility; it is a
> Windows- only thing ?

Yes, it suppresses the creation of a console window.

fo...@x9c.fr

unread,
Mar 7, 2008, 10:52:16 AM3/7/08
to caml...@yquem.inria.fr

Le 2 mars 08 à 11:53, fo...@x9c.fr a écrit :

>
>
> However, I noticed a bug with the binary package that does not show
> up if you have
> the standard OCaml distribution installed on your computer: the
> ocamlc.jar/ocamljava.jar
> compilers will fail if the current directory contains the by-product
> of a previous compilation
> (e.g. cmo or cmi files). The temporary workaround is to delete these
> files before any
> compilation.
>
> I suspect this bug has something to do with the embedded mode (the
> ability for the
> Java-run programs to look for files inside their jar files rather
> than on the local file
> system). I will hunt this bug and report to the list when it is fixed.
> Sorry for the inconvenience in the meanwhile.

This bug, as well as some other ones, have been fixed in the newly
updated version.
To keep in touch with updates, one can refer to the RSS feed:
feed://ocamljava.x9c.fr/rss.xml

Adrien

unread,
Mar 22, 2008, 2:39:02 PM3/22/08
to fo...@x9c.fr, caml...@yquem.inria.fr
Hi,

I wanted to report a small (display) bug.
I'm using ocamljava often for different purposes and among them,
calculator. I had just calculated something and wanted to check my
results I launched ocamljava's toplevel.
I had some rather weird results. For instance:
# 1000.**10.;;
- : float = 1.00000000000000000e+3

..


I think this is just a matter of display. Take a look at the following example :
# 8.**35.;;
- : float = 4.05648192073033400e+31
# 8.**34.;;
- : float = 5.07060240091291760e+3
# 8.**33.;;
- : float = 6.33825300114114700e+29

It seems the last '0' is not displayed.


PS : Vista SP1, JRE 1.6.0_03-b05, Core2Duo and same on XP SP2, JRE 1.6, P4


---

Adrien Nader

fo...@x9c.fr

unread,
Mar 24, 2008, 5:24:57 PM3/24/08
to caml...@yquem.inria.fr

Le 22 mars 08 à 19:38, Adrien a écrit :

> Hi,
>
> I wanted to report a small (display) bug.
> I'm using ocamljava often for different purposes and among them,
> calculator. I had just calculated something and wanted to check my
> results I launched ocamljava's toplevel.
> I had some rather weird results. For instance:
> # 1000.**10.;;
> - : float = 1.00000000000000000e+3
>
> ...

>
>
> I think this is just a matter of display. Take a look at the
> following example :
> # 8.**35.;;
> - : float = 4.05648192073033400e+31
> # 8.**34.;;
> - : float = 5.07060240091291760e+3
> # 8.**33.;;
> - : float = 6.33825300114114700e+29
>
> It seems the last '0' is not displayed.

This is indeed a very embarassing bug in the float to string conversion.
It is now fixed in the darcs repository (of the Cadmium subproject).
The upcoming binary revision will of course also feature this fix.
Thanks for reporting this bug.


Xavier Clerc

PS: bugs can also be reported at http://bugs.x9c.fr/

0 new messages