Re: [tcljava-user] Executing tcl script from java using Interp,need ,help about classpath
Brought to you by:
mdejong
From: Ying J. <yi...@as...> - 2001-03-30 21:02:27
|
Thank you for your response! There is a snippet of code from the documentation that we are trying to get to work. We are trying to create a tcl interpreter object from a Java program. The link to the documentation file in our installed copy of tclBlend is: C:\unzipped\tclBlend126\tclBlend1.2.6\docs\TclJavaLib\Interp.htm The snippet of code from that documentation says: EXAMPLE The following is an example of how an instance of the Interp object may be used: Interp interp; interp = new Interp(); interp.eval("puts {Hello, world}"); interp.dispose(); We created a Java program that has these lines of code. The code does not work for us and the problem appears to be the line that creates the new Interp object. We want to be able to call Interp.eval( ) from the Java program, sending it either a filename with tcl script or a string with a tcl command. The eval method of the Interp object is documented in the following html file from the documentation: C:\unzipped\tclBlend126\tclBlend1.2.6\docs\TclJavaLib\Eval.htm I hope this clarifies what we are trying to do. At the moment, we are just trying to get the example from the documentation to work. Are you implying that creating and calling Interp from Java does not work? We are confused when you say "That is all that is supported in version 1.2." Do you mean Java 1.2 or TclBlend 1.2? What do you mean by 1.3 version in the CVS? Amy Sundermier & Ying Jin Mo DeJong wrote: > On Wed, 28 Mar 2001, Ying Jin wrote: > > > Thank you very much! > > I added tcljava.jar and tclblend.jar to my CLASSPATH, but I got the SAME error message. Could you give me further advise? Thanks a lot. > > I got the SAME error message when I ran this java code inside tcl (After I type nmake shell). But I can successfully run other commands like "puts "say hello" " inside tcl. I also can create my own extension command. > > The only problem is how to invoke tcl script by java code. > > My code stop at new Interp(). Inside the constructor of Interp.java, the code stop at "interpPtr=create( ) ;". > > Thanks a lot. > > Ying > > Step 1: > > Run `nmake shell` that type `package require java`, that should > work and return the version. > > Step 2: > > Get your CLASSPATH and PATH setup the same as in a > `name shell` run. If that works you should be able > to start tcl and run `package require java` without > getting an error. If you get an error, then > your path are not set correctly. > > That is all that is supported in version 1.2. > Your "invoke tcl script by java code" comment is what > has me wondering. Are you trying to load Tcl and > Tcl Blend into an existing JVM? That is > not supported in 1.2, but it does work > in the 1.3 version in the CVS. Is that > what you are trying to do? > > Mo DeJong > Red Hat Inc > > _______________________________________________ > tcljava-user mailing list > tcl...@li... > http://lists.sourceforge.net/lists/listinfo/tcljava-user |