Version 9 of Building JACL with Msys

Updated 2005-07-10 09:29:39

PT 19-Sep-2003

The Msys package from the mingw project [L1 ] provides a minimal unix shell environment that can be used to run configure scripts for many open source packages. Following some Tclers chat discussion, here is how to setup Msys for use with the JDK and optionally with jikes to build jacl.

Once Msys is installed and you run the shell using the icon provided you are using a bash shell. If you have never used a unix shell before, then you should read a tutorial from [provide a link]. The shell needs to be told where you installed your JDK files. This is most simply done by creating a directory with mkdir /etc/profile.d and copying the following text into a jdk.sh file in this subdirectory.

  JDK=/opt/j2sdk1.4.2
  JRE=$JDK/jre

  if [ -d $JDK ]; then
     PATH=$PATH:$JDK/bin
     CLASSPATH=.:$JDK/lib/tools.jar:$JDK/lib/dt.jar:$JRE/lib/rt.jar:$JRE/lib/jsse.jar:$JRE/lib/jce.jar
     export PATH CLASSPATH
  fi

If you restart your Msys shell, then entering 'javac' at the command line should give you a help message from javac.

Now you are all set. Unpack the jacl source somewhere and cd to that location. Then do something like

  ./configure --prefix=/opt/jacl --with-jdk=$JDK

If you want to use jikes as the compiler then do

  ./configure --prefix=/opt/jacl --with-jdk=$JDK --with-jikes=/opt/bin/jikes.exe

Then do

  make
  make test
  make install

and it's done. That's it. Go play.

 $ /opt/jacl/bin/jaclsh
 % parray tcl_platform
 tcl_platform(byteOrder)     = bigEndian
 tcl_platform(host_platform) = windows
 tcl_platform(machine)       = x86
 tcl_platform(os)            = Windows XP
 tcl_platform(osVersion)     = 5.1
 tcl_platform(platform)      = java
 %

CB - 19-Sept 2003

Thanks, the above was very helpful. I've wanted to start playing with JACL but had been wary of the build process on Windows. This really helped me get going.

CB Here are some notes on Building TclBlend with msys_mingw


Patrick Finnegan - 10/07/2005

I have set up a jacl installation on Windows XP to run from the windows command line. Mysys is not needed at runtime but it's still needed for the compile stage(generation of jacl.jar and tcljava.jar). I just converted the jaclsh script from bash to dos. See below.

I installed following the instructions at this link "http://wiki.tcl.tk/9993 " but set up my directory structure a little differently.

I created "D:\JACL" then copied the Sun 1.3.1 JDK directory into "D:\JACL\jdk1.3.1_01". I set the install directory options to "d:\jacl" and the jdk location to "D:\JACL\jdk1.3.1_01" at the mysys make/install stage and finally I copied the demo directory from the jacl download directory to "D:\JACL\demos". The final install directory structure looks like:

D:\JACL\bin D:\JACL\demos D:\JACL\jdk1.3.1_01 D:\JACL\lib

The advantage of this approach is that it packages the 1.3.1 JDK with JACL so that it's possible to zip up the directory structure and port the installation from machine to machine(Windows) with no need to re-compile. JACLSH.cmd starts the jacl shell. Just make sure the bat file directory locations are correct i.e. "c:" or "d:".

Running the shell

E:\home\pfinnegan>cd /d d:\jacl\bin

D:\JACL\bin>

D:\JACL\bin>jaclsh.cmd

% pwd D:/JACL/bin

% cd ../demos

% pwd

D:/JACL/demos

%% glob * gluepkg gridDemo packDemo pyramidpkg README simplepkg VolcanoRobot watchpkg

% cd gridDemo

% pwd

D:/JACL/demos/gridDemo

% glob *

grid.tcl gridDemo.tcl README

% source gridDemo.tcl

................................ brings up the "Downsize Assistant" java gui.

JACLSH.cmd - windows bat file to start JACL shell.

@echo off

:: Wrapper script to start up Jacl

set prefix=d:\jacl

:: Tcl/Java version number set TCLJAVA_VERSION=1.3.1

:: Directory where platform independent files live. This :: includes the .jar files and any .tcl files

set XP_TCLJAVA_INSTALL_DIR=%prefix%\lib\tcljava%TCLJAVA_VERSION%

set JACL_CLASSPATH=d:\JACL\jdk1.3.1_01\lib\tools.jar;d:\JACL\jdk1.3.1_01\lib\dt.jar;d:\JACL\jdk1.3.1_01\jre\lib\rt.jar;%XP_TCLJAVA_INSTALL_DIR%\tcljava.jar;%XP_TCLJAVA_INSTALL_DIR%\jacl.jar

:: Fully qualified path name of JVM executable set JAVA=d:\JACL\jdk1.3.1_01\bin\java

:: The arguments to the JAVA command set JAVA_FLAGS="-native -ms5m -mx22m"

:: Run java with the args passed in from the calling environment :: We must set the CLASSPATH env var instead of using the -classpath :: argument because jacl might want to exec a program that also :: depends on the CLASSPATH setting and Java can not export env vars

set CLASSPATH=%JACL_CLASSPATH%;%CLASSPATH%

echo "CLASSPATH is .........." echo %CLASSPATH% echo " " echo "PATH is ............." echo %PATH% echo " "

echo %JAVA% %JAVA_FLAGS% tcl.lang.Shell echo " "

%JAVA% %JAVA_FLAGS% tcl.lang.Shell


See also jacl, mingw