I was just looking at some Tcl/Java code that someone wrote
and I noticed that they did not seem to understand how to
use the java::import method. Here is a short snip of the code.

package require java
java::import -package java.sql

I want to make sure that everyone knows that this bit
of code does not do the same thing as the following
java statement.

import java.sql.*;

In fact, the Tcl/Java code from above does nothing at all
because [java::import -package java.sql] would just return
the classes in the java.sql package that had been imported
by an earlier call to java::import. Why you ask? Well
because that is how it works. Also, there is no way to
find the names of all the classes in a package using the
Java 1.1 reflection API. There is also the fact that using
a * pattern can lead to broken code if classes in a package
are changed at a later date. I thought I made this clear
in the docs, but perhaps adding a bit about how not to
use the command would keep people from making this error
in the future.

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