- 1. What additional resources are there regarding Tcl & Java
Integration?
-
Christopher Hylands maintains his own
page
that lists a plethora of information. There are links to related
Web pages, his own personal notes about building and using Jacl
and Tcl Blend, and in depth explainations about Tcl and Java
Integration.
If you are interested in a more detailed forum focused in
issues related to Jacl and Tcl Blend you might want to
subscribe to the tcljava users mailing list maintained by Tcl Developer
XChange. You can subscribe to the list going to
http://lists.sourceforge.net/mailman/listinfo/tcljava-user.
Once you have subscribed you should be able to send mail to
[email protected]. You can access emails
archived from the mailing list using the
Mail Archive.
As always, questions about Jacl or Tcl Blend can be sent to
the Tcl newsgroup at comp.lang.tcl.
- 2. Does Jacl or Tcl Blend work with the JDK1.2?
-
Jacl and Tcl Blend both work with JDK1.2. When Tcl Blend
is compiled with JDK1.2, it fails a few of the tests, see
the known_issues.txt
file in the distributions of
Tcl Blend for more details. To use Tcl Blend with JDK1.2, you
must recompile under JDK1.2.
- 3. Why isn't Tk implemented in Jacl?
-
Because it is hard, that's why :-)
Implementing Tk using Java AWT widgets would be a very large
task. Using Tcl Blend and embedding Tk widgets in AWT frames
might be easier. Currently, there are no plans to implement either
of these features.
- 4. Can I use the Tcl Plugin to access Jacl or Tcl Blend?
-
At this time, no. At the 1998 Tcl Conference, many people expressed
interest in using the Plugin with Jacl and/or Tcl Blend.
Currently, no one is working in this area.
- 5. Where is the Linux Tcl Blend port?
-
Jacl and Tcl Blend 1.2 both work on Linux. The IBM JDK 1.1
does not have support for native threads and will not work
properly with Tcl Blend, but should work with Jacl. The
Blackdown and Kaffe JDKs both work.
- 6. Where is the Macintosh release?
-
Yes, it is rather sad, but nobody currently developing Jacl and
Tcl Blend has access to a Mac, therefore we could not produce a
source release for downloading.
- 7. What is the future of Jacl and Tcl Blend?
-
Currently all of the work on Jacl and Tcl Blend is being developed
Mo DeJong with help from Tcl Developer Xchange. Tcl Developer Xchange is facilitating
their efforts by hosting the Web site, maintaining
NetCVS
repository, and tracking related bug reports. At this point, the
future is in the hands of the Tcl community, with minimal support
from Tcl Developer Xchange. As resources increase and demand dictates,
Tcl Developer Xchange will look into additional Tcl & Java integration
solutions.
- 8. Does Tcl Blend work with Tcl8.2?
-
Tcl Blend 1.2 supports Tcl8.2 and includes a TEA-compliant
makefile for Unix and Windows.
- 9. Does Tcl Blend work with green threads on Solaris or Linux?
-
No, Tcl Blend requires the native thread package for
Solaris or Linux. Initially we intended to make Tcl Blend work with
green threads. However, this became too much work to justify
supporting.
- 10. Why doesn't my code work anymore? I get 'no such method X in class Y.'
-
This is a result of a change to the method invocation system. Here
is an example that will make things more clear.
Assume we are using the following Java class:
public class simple {
private String text = "hi"
public Object get() {
return text;
}
}
Now assume that our old Tcl code was as follows:
set simple[java::new simple]
set string [$simple -noconvert get]
$string charAt 0
The chatAt method would return 'h' in version 1.0, but
this actually violated the Java Language Specifications
because it incorrectly allowed method invocations on
the type Object that should only be allowed on String.
Here is how to fix your code so that it runs correctly.
set simple [java::new simple]
set object [$simple -noconvert get]
# Cast the type of the reference up from Object to String.
set string [java::cast String $object]
$string charAt 0
- 11. How do I create an array of objects?
-
We now offer direct array support via the java::new and array
object commands. To create an int[5]
array with
values 11 through 15, you can say:
set arrayObj [java::new {int[]} 5 {11 12 99 14 15}]
$arrayObj set 2 13
- 12. How does TclBlend handle 64-bit values?
-
TclBlend 1.2+:
In Java, 64 bit values are stored in the primitive type long. Earlier versions
of Tcl/Java would convert these long values into a Tcl 32-bit int, which would
result in a loss of precision. The motivation behind this was to support using
returned 64-bit values in Tcl's expr command. In Tcl/Java version 1.2, 64-bit
long values are not converted to int values, they are instead stored as strings.
This means that 64-bit Java values can be stored inside Tcl and passed to
Java, but you can not use a Tcl proc that expects a Tcl int with a 64-bit
Java value.
TclBlend 1.0 through 1.1:
Jacl uses the Java int
type to store integer
values internally for performance reasons. If a Java method call
returns a 64-bit value, it will be cast to an int
before being returned. This will result in a loss of precision.
Tcl uses the C type long
to store integer
values. Depending on the host architecture, this may be 32 or 64
bits. If a Java method call returns a 64-bit value, it will be
cast to a C long
before being returned. On some
machines this will result in a loss of precision.
- 13. Does Jacl or Tcl Blend work inside browsers?
-
Currently there are many issues that makes it difficult to run Jacl or
Tcl Blend as an applet inside popular web browsers:
-
For remote applets, both Netscape and IE disallow the
introspection of class members. This makes it impossible to use any of
the following commands:
java::new
,
java::call
, java::prop
,
java::field
.
-
You can install Jacl as a local Java package on your machine to
get around the restriction mentioned in (a), but then Netscape won't
read any of the Jacl library scripts, such as init.tcl, because it
doesn't allow your applet to read from local disks.
(1) and (2) together makes it difficult to run Jacl as either a
remote or a local applet.
- Netscape 4.0.x doesn't yet support the JDK 1.1 event
model. That makes it impossible to create event handlers for any AWT
widgets created by the java::new command.
- Plus, Tcl Blend contains native code. That makes it even
harder to load into browsers.
Due to these current difficulties, we have decided not to support the
use of Jacl or TclBlend inside applets.