paraffin.tcl is a command line utitlity to build a custom JAR file which includes the JTcl interpreter, an application, and other library JAR files. paraffin.tcl is included in the JTcl distribution.
jtcl paraffin.tcl [ -i ] app-name source-directory start-file [ jar-directory ]
where:
The resulting JAR file can be executed by specifying the -jar option to the java command:
java -jar app-name.jar
Consider an application that contains a main file, a file containing some utility procedures, and a library of Tcl packages, with a directory structure as
./myapp_dir
main.tcl
misc-procs.tcl
tclIndex
lib
package1
pkgIndex.tcl
package1.tcl
package2
pkgIndex.tcl
package2.tclmain.tcl contains the following code:
# get our directory and append our packages to auto_path
set startup_dir [file dirname $::argv0]
lappend auto_path $startup_dir
lappend auto_path [file join $startup_dir lib package1]
lappend auto_path [file join $startup_dir lib package2]
package require package1
package require package2
# now execute our startup code
...etc...A stand-alone JAR file can be built and run using paraffin.tcl as:
jtcl paraffin.tcl -i my-app myapp_dir main.tcl
java -jar my-app.jar