JACL和Eclipse结合编程

Jacl and Eclipse edit

 

During Jan, 2007, Patrick Finnegan posted a HOWTO for running Jacl with Eclipse as an external tool [1]. I'll include his notes here, so that as refinements are found, they can be incorporated.

 

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

 

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值