On Mon, 14 Jun 1999 [EMAIL PROTECTED] wrote:
> I'm having trouble with the 'package require java' command. It will
> execute just fine from the tclsh prompt but gets an error when run from
> within my C test program.
>
> Here's the screen output:
>
> TCLSH output
>>-----------------------------------------------------------------------<
> d:\>tclsh
> % package require java
> 1.1.1
> % puts $auto_path
> d:/mdisql/tcl8.0/lib/tcl8.0 d:/mdisql/tcl8.0/lib
> % exit
>
> C PROGRAM output
>>-----------------------------------------------------------------------<
> d:\>qasql -Uuserid -Ppasswd -Sservice
> 1> puts $auto_path
> /remote/srel2/tnt/release/lib/qasql
> 1> set auto_path "d:/mdisql/tcl8.0/lib/tcl8.0 d:/mdisql/tcl8.0/lib"
> 1> puts $env(TCL_LIBRARY)
> d:\mdisql\tcl8.0\lib
It seems like the tclblend.jar file is not getting included on your
CLASSPATH. The tcl/lang/Interp.class file should be inside the
tclblend.jar archive. This would most likely happend if the .jar file
was not found. Tcl Blend's pkgIndex.tcl file should append the location
of the tclblend.jar file to your CLASSPATH when it is loaded so a good
test would be to print out the value of env(CLASSPATH) in your custom
program to see what it is set to. You might also want to try the 1.2.3
release as it has some extra debug output that you can activate in the
pkgIndex.tcl file. It might help you track down this problem. Another
good test you can try is to set env(CLASSPATH) in your custom shell
and then call "load tclblend.dll" directly from the command line.
This is rather low level but it can help point out problems. Loading
Tcl Blend under windows should be easier but without a good shell tool
(like /bin/sh under unix), settting up env vars and executing a program
is very difficult.
> 1> puts [package require java]
> Exception in thread "main" java.lang.NoClassDefFoundError: tcl/lang/Interp
> ERROR(5): Loading 'd:/mdisql/Tcl8.0/lib/tclblend1.1.1/tclblend.dll' failed.
> This can happen if the appropriate Java .dlls are not in your path.
> Under JDK1.1, tclblend uses javai.dll, which is usually
> found in c:\jdk1.1.6\bin.
> Under JDK1.2, tclblend uses jvm.lib, which is usually
> found in c:\jdk1.1.2\jre\bin\classic.
> You may need to add the appropriate directory to your PATH.
> The error was:
> could not find class tcl/lang/Interp.
> Check that your path includes the directory where tclblend.dll resides.
> Try looking in the directories under the value of tcl_library,
> currently: d:/mdisql/tcl8.0/lib/tcl8.0
This seems to be a good indication of the problem. I do not see
tcljava.jar and tclblend.jar on this CLASSPATH.
> Currently, the CLASSPATH environment variable is set to:
> d:\mdisql\tcl8.0\lib\tclblend1.1.1;c:\jdk1.1.7B\bin;c:\jdk1.1.7b\lib\classes.zip;
> C:\Program Files\Exceed.nt\hcljrcsv.zip;C:\Program Files\Exceed.nt
> The JVM currently is using the following
>classpath:c:\jdk1.1.7b\bin\..\classes;c:\jdk1.1.7b\bin\..\lib\classes.zip;
> c:\jdk1.1.7b\bin\..\lib\classes.jar;c:\jdk1.1.7b\bin\..\lib\rt.jar;
> c:\jdk1.1.7b\bin\..\lib\i18n.jar
>
> 1> puts $env(TCL_LIBRARY)
> d:\mdisql\tcl8.0\lib
> 1> exit
>
> The thing that jumps out at me is how TCL_LIBRARY is reported in the error message
>to be:
> d:/mdisql/tcl8.0/lib/tcl8.0
> yet before and after issuing the 'package require java' command, it is
> reported to be:
> d:/mdisql/tcl8.0/lib
>
> The second is the correct value that it should be set to and the way it
> is set in the system's environment.
>
> This error is being trapped at or around line 153 of pkgIndex.tcl.
> if [catch {load $native_lib} errMsg] {
> ...
> }
> Why would the load command be using a different value for TCL_LIBRARY than
> the one set in the environment?
>
> Also of note is how auto_path is set to one thing when in tclsh and
> something entirely different when running the C Program.
>
> Is it possible that these things are the cause my problem?
>
> I have the jdk1.1.7b\bin directory on my path and the CLASSPATH contains
> the tclblend1.1.1 directory.
>
> Is there something else I should be looking for?
>
> This C Program reads tcl scripts but also allows SQL calls to be made
> into a few different databases.
>
> Any help would be greatly appreciated.
>
> thanks,
> -Mike Bryan
>
> ----------------------------------------------------------------
> The TclJava mailing list is sponsored by WebNet Technologies.
> 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]'.
> A list archive is at: http://www.findmail.com/listsaver/tcldallas/
>
----------------------------------------------------------------
The TclJava mailing list is sponsored by WebNet Technologies.
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]'.
A list archive is at: http://www.findmail.com/listsaver/tcldallas/