From: Georgios Petasis on
Hi all,

I have written a Tcl extension in Java:

public class JavaTest extends Extension {
public void init(Interp interp) {
/* Register some commands... */
interp.createCommand("creole_JavaTest",
new creole_JavaTest());
}

public static void SetComponentHome(String path) {
System.out.println("JavaTest::SetComponentHome("+path+")");
creole_JavaTest.creole_JavaTest_home = path;
}
} /* class JavaTest */

My "JavaTest" that is an extension, has a new method "SetComponentHome".
Is there a way to call this method?

I can load the extension with:

java::load -classpath path JavaTest

but the JavaTest class seems to disappear after the extension gets
loaded. Any ideas on how to call SetComponentHome?

George
From: Bruce on
Georgios Petasis wrote:
> Hi all,
>
> I have written a Tcl extension in Java:
>
> public class JavaTest extends Extension {
> public void init(Interp interp) {
> /* Register some commands... */
> interp.createCommand("creole_JavaTest",
> new creole_JavaTest());
> }
>
> public static void SetComponentHome(String path) {
> System.out.println("JavaTest::SetComponentHome("+path+")");
> creole_JavaTest.creole_JavaTest_home = path;
> }
> } /* class JavaTest */
>
> My "JavaTest" that is an extension, has a new method "SetComponentHome".
> Is there a way to call this method?
>
> I can load the extension with:
>
> java::load -classpath path JavaTest
>
> but the JavaTest class seems to disappear after the extension gets
> loaded. Any ideas on how to call SetComponentHome?
>
> George


the docs say you can use java::call to invoke static methods
on java classes

does that not work?

bruce
From: Georgios Petasis on
Στις 12/8/2010 00:14, ο/η Bruce έγραψε:
> Georgios Petasis wrote:
>> Hi all,
>>
>> I have written a Tcl extension in Java:
>>
>> public class JavaTest extends Extension {
>> public void init(Interp interp) {
>> /* Register some commands... */
>> interp.createCommand("creole_JavaTest",
>> new creole_JavaTest());
>> }
>>
>> public static void SetComponentHome(String path) {
>> System.out.println("JavaTest::SetComponentHome("+path+")");
>> creole_JavaTest.creole_JavaTest_home = path;
>> }
>> } /* class JavaTest */
>>
>> My "JavaTest" that is an extension, has a new method "SetComponentHome".
>> Is there a way to call this method?
>>
>> I can load the extension with:
>>
>> java::load -classpath path JavaTest
>>
>> but the JavaTest class seems to disappear after the extension gets
>> loaded. Any ideas on how to call SetComponentHome?
>>
>> George
>
>
> the docs say you can use java::call to invoke static methods
> on java classes
>
> does that not work?
>
> bruce

No. It does not see at all the JavaTest class.
I can load it, its init gets called, but somehow it is not visible as a
class in tclBlend.

George