This is the mail archive of the kawa@sources.redhat.com mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Newbie question


On 22 Aug 2000, Per Bothner wrote:

> "s.blomberg" <nhi965@abdn.ac.uk> writes:
> 
> > Is it a simple matter of creating it as a java class using the -C
> > directive in kawa? If so, how do I call it from java? Please help out a
> > newbie!
> 
> There are different ways of doing it.  If you use the module facility,
> you can just invoke the Scheme procedure as a method.  ("Static modules"
> are probably your best bet.)

OK, from the manual, I could write some simple scheme code such as:

(module-export Adder)
(define (Adder x) x)
(define (add5 x) (+ 5 x))

then save the code in Adder.scm and compile it to a java class using the
-C directive. I get three class files, which I then add to my CodeWarrior
project file. Then suppose I want to use add5 in some java, I could write:

public class TrivialApplication {

	public static void main(String args[]) {
		Adder ans = new Adder();
		System.out.println( ans.add5( 5 ) );

	}
}

which should (I think) result in 10 being printed in the console window.
But I get the following errors when I make the project:

Error : Class gnu.expr.ModuleBody not found in class Adder.

Error : Class gnu.expr.ModuleBody not found in void
main(java.lang.String[]). TrivialApplication.java line 6
System.out.println( ans.add5( 5 ) );

Can anyone tell me how to fix this? 

> 
> I suggest reading the Kawa manual, and using the current version 1.6.70.

With respect, the manual is heavy going for a beginner. A short tutorial
would be nice! I'm using version 1.6.59, which is the latest version on
the "Kawa for Macintosh" web page. Will support for kawa on macs improve?

Thanks again,

Simon.

S. P. Blomberg 
Dept of Zoology
University of Aberdeen 
Aberdeen, AB24 2TZ, UK. s.blomberg@abdn.ac.uk


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]