On Thu, 29 Jun 2000, Jiang Wu wrote:

> 
> > -----Original Message-----
> > From: Mo DeJong [mailto:[EMAIL PROTECTED]]
> > 
> > You are using Tcl blend and Tcl loaded into a JVM right? I get the
> > feeling Tcl does not know how to find its startup scripts. What
> > happens when you do a "package require java"? This is strange
> 
> I have to set the TCL_LIBRARY environment variable.  Otherwise, it won't be
> able to find the startup script.  There is no access to Tcl_FindExecutable,
> which a normal Tcl shell use to find the startup script, in TclBlend.


So add it. Would something like this work? I am not sure where
you would get the executable name, perhaps you can just use "java".

Java_tcl_lang_Interp_create(
    JNIEnv *env,                /* Java environment. */
    jobject interpObj)          /* Handle to Interp object. */
{
    jlong lvalue;
    Tcl_Interp *interp;
    JNIEnv *oldEnv;
    int loadedFromJava = (currentEnv == NULL); /* true if Tcl Blend was 
loaded into Java */

    if (! loadedFromJava) {
        PUSH_JAVA_ENV();
    } else {
        Tcl_FindExecutable(NULL);
    }

    interp = Tcl_CreateInterp();


 
> > > Otherwise, it may not work.
> > > 
> > >   set x [java::new String foo]
> > >   java::lock $x                   <--  may or may not work
> > 
> > I don't see why you think that "may or may not work".
> 
> It won't work if Tcl uses the string form for the result from [...].  "set
> x" and "$x" are executed inside Tcl, not TclBlend.  There is no control over
> what representation is picked by Tcl.  This is the cause for the whole mess
> with the "command not found" we have been discussing lately.

I don't follow. When the call to java::new returns a TclObject
it should have a ReflectObject internal rep. You then set the
variable x so that it holds the TclObject. At that point,
you lock the internal rep. If you change the internal rep
of x after that, the Java object will not be freed.
Where is the "no control" here?

Mo DeJong
Red Hat Inc

----------------------------------------------------------------
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/tcljava@scriptics.com

Reply via email to