Take a look at chapter 7 of the Sleep Manual:
http://sleep.dashnine.org/manual/hoes.html
The general idea is this:
import whatever.package.* from: filename.jar;
$object = [new ClassName: arg1, arg2, ...]; # instantiate the instance
$value = [$object method: arg1, arg2]; # call a method
$value = [$object method]; # call a method with no arguments.
$value = [ClassName someMethod: arg1, arg2]; # call a static method
$value = [ClassName fieldName]; # access a static field's value e.g.,
[Integer MAX_VALUE]
setField($object, var => 1); # object.var = 1;
Sleep guesses the Java values to change into and does a decent job of
this. If it's wrong for some reason, use the cast and casti functions
to cast a Sleep scalar into a specific Java type.
I usually start out by taking the hello world example for a library,
porting it to Sleep, and then hacking on it from there. Here's an
untested port of the first few lines from:
http://www.andykhan.com/jexcelapi/tutorial.html
import java.io.File;
import java.util.Date;
import jxl.* from: jxl.jar;
$workbook = [Workbook getWorkbook: [new File: "myfile.xls"]];
$sheet = [$workbook getSheet: 0];
$a1 = [$sheet getCell: 0, 0];
$b2 = [$sheet getCell: 1, 1];
$c2 = [$sheet getCell: 2, 1];
println([$a1 getContents]);
println([$b2 getContents]);
println([$c2 getContents]);
-- Raphael
> --
> -----
> To post to this group, send email to sleep-de...@googlegroups.com
> To unsubscribe from this group, send email to sleep-develope...@googlegroups.com
> For more options, visit this group at http://groups.google.com/group/sleep-developers?hl=en
>
> The Sleep Scripting Project: http://sleep.dashnine.org/
Dan
Your solution should make things easier.
Andy