Hello,
Toga Hartadinata is
> [...] wondering can the tcl shell used the return value of a java function
> call ?
> Here is some code example
> public class test{
> public int run() {
> return 10;
> }
> }
> and then in tcl shell
> set t [java::new test]
> now can it do
> set result [$t run] ??? to set the value to 10 ?
> or is there any way to make this interaction happened ?
Sorry, but I can't see your problem. After creating the file test.java
with the contents above I did the following:
bash-2.03$ javac test.java
bash-2.03$ ls -l test*
-rw-r--r-- 1 krischan install 281 Aug 16 09:01 test.class
-rw-r--r-- 1 krischan install 78 Aug 16 09:01 test.java
bash-2.03$ CLASSPATH=. jaclsh
% package require java
1.3.0
% set t [java::new test]
java0x1
% set x [$t run]
10
% exit
bash-2.03$
So everything seems to work as you expected. It is *really* so easy
to interact from Tcl with your Java classes!
Note: If the method is declared static,
public static int run() {return 10;}
you can use the java::call method to invoke it:
bash-2.03$ CLASSPATH=. jaclsh
% package require java
1.3.0
% java::call test run
10
% exit
Hope this helps,
Krischan
--
Christian Krone, SQL Datenbanksysteme GmbH
----------------------------------------------------------------
The TclJava mailing list is sponsored by Scriptics Corporation.
To subscribe: send mail to [EMAIL PROTECTED]
with the word SUBSCRIBE as the subject.
To unsubscribe: send mail to [EMAIL PROTECTED]
with the word UNSUBSCRIBE as the subject.
To send to the list, send email to '[EMAIL PROTECTED]'.
An archive is available at http://www.mail-archive.com/[email protected]