HOWTO: Run JACL with the Eclipse Ide as an external tool.

70 views
Skip to first unread message

Patrick Finnegan

unread,
Jan 6, 2007, 6:28:33 PM1/6/07
to
It's now possible to run JACL with the Eclipse IDE as an external tool.


Installation Instructions.
**************************

1. Install Java.

Download the java runtime from http://www.java.com and install on your
machime.

2. Download JACL

Download the JACL 1.4.0 jaclBinary140.zip binary from
http://sourceforge.net/projects/tcljava/

3. Extract the binary.

Extract jaclBinary140.zip to a local directory e.g
C:\Downloads\jacl\jaclBinary140\jacl140\lib\tcljava1.4.0.

4. Install the jar files.

JACL enable the Java runtime by copying the JACL jar files from the
extract directory to the ext directory of the java install. The JACL
jar files will be dynamically loaded by the JVM at runtime.

E.G copy the following jar files from
C:\Downloads\jacl\jaclBinary140\jacl140\lib\tcljava1.4.0 to C:\Program
Files\Java\jre1.5.0_10\lib\ext.

itcl.jar jacl.jar janino.jar tcljava.jar tjc.jar

5. Test the installation by starting an interactive shell.

C:\>java tcl.lang.Shell
%

# enable Java commands.

% package require java
1.4.0

# get local ip address.

% java::import java.net.InetAddress
% puts "My IP Address is: [ [ java::call InetAddress getLocalHost ]
getHostAddress ] "
My IP Address is: 123.45.67.89

6. Install Eclipse.

Download Eclipse from www.eclipse.org and install to a local directory.
If there is more than one java runtime installed on machine ensure the
one used by Eclipse has the Jacl jar files in it's ext directory.

7. Install Eclipse Tcl Plugin.

Download the Eclipse Tcl plugin from http://www.eclipsedltk.org/ and
install into Eclipse. Simply follow the standard plugin installation
procedure and copy the eclipse directory in the zip file over the
eclipse install directory.

8. Create a Tcl project.

Start Eclipse and create a Tcl Project: File --> new --> other --> Tcl
Project.

Create a Tcl file called quickTest.tcl in the project: File --> new -->
other --> DLTK Tcl --> Tcl File

Add the following commands to quickTest.tcl then save.

clock format [ clock seconds ]
package require java
puts "current directory is [ java::call System getProperty user.dir ]"
java::import java.net.InetAddress
puts "My IP Address is: [ [ java::call InetAddress getLocalHost ]
getHostAddress ] "

9. Configure JACL as an external tool.

Create a new external tool: Select run --> external tools --> external
tools.

Double click on program.

Set the following parameters.

name: jaclShell
location: Java installation directory. E.G. C:\Program
Files\Java\jre1.5.0_10\bin\java.exe
working directory: ${container_loc} - This resolves to the folder
location of quickTest.tcl in Eclipse.
arguments: tcl.lang.Shell ${resource_loc} ${resource_name} - resolves
to the location of the selected tcl file which in this case is
quickTest.tcl.

Close the dialog.

10. Select and run quickTest.tcl.

Click once on quickTest.tcl to highlight.
>From the top menu select run --> external tools --> jacLShell. Do NOT
right click --> runas.

The following is written to the Eclipse console.

current directory is C:\EclipseWorkSpaces\JaclScripts\testScripts
My IP Address is: 123.45.67.89

11. And the whole point of this exercise is..............

Well it's really code management and the convenience of having Jacl and
Java packages in the same workspace.

Michael A. Cleverly

unread,
Jan 6, 2007, 7:09:11 PM1/6/07
to
On Sat, 6 Jan 2007, Patrick Finnegan wrote:

> 11. And the whole point of this exercise is..............
>
> Well it's really code management and the convenience of having Jacl and
> Java packages in the same workspace.

This is very cool! Thanks for writing it up.

Michael

Donal K. Fellows

unread,
Jan 7, 2007, 8:00:53 AM1/7/07
to
Patrick Finnegan wrote:
> It's now possible to run JACL with the Eclipse IDE as an external tool.

Good write-up. Thanks! (Now, time to get JACL integrated with my Eclipse
setup...)

Donal.

Donal K. Fellows

unread,
Jan 7, 2007, 1:17:34 PM1/7/07
to
Patrick Finnegan wrote:
> arguments: tcl.lang.Shell ${resource_loc} ${resource_name} - resolves
> to the location of the selected tcl file which in this case is quickTest.tcl.

Just a small note. I advise putting double quotes around
${resource_loc} and ${resource_name} because their expansion might have
spaces in (especially ${resource_loc} if you're keeping your Eclipse
workspace below "My Documents"...)

Donal.

Reply all
Reply to author
Forward
0 new messages