★ wanayoo — archive 1999 http://www.scriptics.com/software/java/faq.htmlNouvelle recherche | Portail wanayoo
Developer Site
Getting StartedTcl AdvocacySoftware ResourcesDocumentsServicesCommunity
Home
Login | Tcl/Tk | TclPro | Tcl Plugin | Tcl/Tk Ports |  Java| | Applications | Extensions | Tools | CVS | Bug DB
Search 
Download | New Features | F.A.Q. | Man Pages

FAQ Index

  • 1. Why do I get a error like couldn't load file tclblend.dll?
  • 2. Is there a mailing list? Where can I get help?
  • 3. What additional resources are there regarding Tcl & Java Integration?
  • 4. Does Jacl or Tcl Blend work with the JDK1.2?
  • 5. Why isn't Tk implemented in Jacl?
  • 6. Can I use the Tcl Plugin to access Jacl or Tcl Blend?
  • 7. Where is the Linux Tcl Blend port?
  • 8. Where is the Macintosh release?
  • 9. What is the future of Jacl and Tcl Blend?
  • 10. Does Tcl Blend work with new versions of Tcl?
  • 11. Does Tcl Blend work with green threads on Solaris or Linux?
  • 12. Why doesn't my code work anymore? I get 'no such method X in class Y.'
  • 13. How do I create an array of objects?
  • 14. How does TclBlend handle 64-bit values?
  • 15. Does Jacl or Tcl Blend work inside browsers?
  • Questions and Answers

    1. Why do I get a error like couldn't load file tclblend.dll?

    This posting to the Tcl/Java mailing list is typical. This error is generated when a Windows dll file depends on another dll that can not be found. The most common cause of this is the user setting the PATH environment variable incorrectly. You need to include both the Tcl and Java shared lib directories on the PATH. See the win/README file that comes with Tcl Blend for a more info on the required PATH settings.

    2. Is there a mailing list? Where can I get help?

    The Tcl/Java mailing list is a low volume forum dedicated to users of Jacl and Tcl Blend. All Tcl/Java related questions should be sent to the mailing list. You will need to subscribe before you can post messages to the mailing list. Subscribe by sending an email with the string "subscribe" in the subject line to [Mailto tcljava-request@scriptics.com]. Once you have subscribed, you should be able to post to the mailing list by sending an email to [Mailto tcljava@scriptics.com]. There is also a searchable online archive of postings to the tcljava mailing list.

    3. 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.

    As always, questions about Jacl or Tcl Blend can be sent to the Tcl newsgroup at comp.lang.tcl.

    4. 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.

    5. Why isn't Tk implemented in Jacl?

    It is. The Swank project is a set of Java classes that wrap Java's swing widgets into Tk commands. Currently, Swank requires the 1.3 version from the CVS. Swank is very pre-alpha, and we need developers to jump in and help out.

    6. 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.

    7. Where is the Linux Tcl Blend port?

    Jacl and Tcl Blend 1.2.6 both work on Linux. You can use the Blackdown JDK port or the IBM JDK port.

    8. Where is the Macintosh release?

    There has been some talk on the mailing list of a Mac port for Tcl Blend. If you have a Mac and you want to help out, please join the mailing list and introduce yourself. There was an old port of Jacl that ran on the Mac but nobody seemed to be very interested in keeping it working.

    9. What is the future of Jacl and Tcl Blend?

    Currently, Mo DeJong is coordinating the Tcl/Java project. There has been a dramatic increase in the number people using and contributing to the Tcl/Java project in the last 6 months. A number of new commands for Jacl have been donated by folks on the net. Ajuba Solutions is facilitating these efforts by hosting the Web site, providing FTP space, and maintaining the CVS repository. Ajuba also uses Tcl Blend in their flagship Ajuba 2 product, so I would not worry about it going anywhere for awhile. The Tcl/Java project will continue as long as people find the technology useful and send in bug reports, patches, and donate code.

    10. Does Tcl Blend work with new versions of Tcl?

    Tcl Blend 1.2.6 supports Tcl 8.0, 8.1, 8.2, and 8.3 and includes a TEA-compliant makefile for Unix and Windows.

    11. Does Tcl Blend work with green threads on Solaris or Linux?

    No, Tcl Blend requires a native threads JVM. Initially we intended to make Tcl Blend work with a green threads JVM, but there are just too many problems to justify supporting a green threads JVM.

    12. 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
        

    13. 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
        

    14. How does TclBlend handle 64-bit values?

    Tcl Blend 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.

    Tcl Blend 1.0 and 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.

    15. 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:

    1. 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.

    2. So the real answer is, Jacl works but it is flaky because the JVM inside of most web browsers are so flaky. There is nothing we can do about a lousy JVM. You also can not load Tcl Blend directly into a web browser, although it might be possible using the Tcl Plug in.

    Top of page
    Developer Home | Ajuba | Getting Started | Tcl Advocacy | Software Resources | Documents | Services | Community
    Search | Site Map | Feedback | Contact Us | webmaster@ajubasolutions.com
    Increase page width
    © 1998-2000 Ajuba Solutions. All rights reserved. Legal Notice | Privacy Statement

    Last modified: November 30, 2000