AGI STK Engine (4DX) Blog

October 1, 2008

Installing STK Engine on Ubuntu Linux

Filed under: Java, Linux — Tags: , , , , — Sylvain @ 5:11 pm

In my last post I promised to give directions about how to install STK Engine 8.02 on Ubuntu 8.04. So here it is, in a few easy steps. I used a VMware virtual machine to generate this procedure. I configured the virtual machine for 1GB of memory and an 8GB hard disk. I started from a clean install of Ubuntu using the default install settings (with dhcp enabled). I also installed the latest (at the time of this writing) Java jdk (in the /usr/java/jdk1.6.0_07 directory).

I created the video below to show the entire process. Detailed instructions follow, but if you just want to see what's involved, or if you need additional information like the output or the behavior of a specific command the video should help! Notice that the video has been created using a virtual machine, so it is slower than what you will experience on a real machine. Also a high resolution version of the video (~95MB) is available here.

Download install from ADN

To get started you need to download the Linux install archive (STKEngine802Linux.tgz) from the ADN Download section. The procedure below assumes that the archive was downloaded to your desktop, i.e. at ~/Desktop/STKEngine802Linux.tgz. If you downloaded to a different location you will need to replace this with the appropriate path on your machine.


There are a few prerequisites before we start installing on Ubuntu. On the officially supported platforms these steps are not necessary because the system comes with the required packages. For Ubuntu we need to install: c shell, stdc++5, motif and ungif. This can be accomplished through the following commands:

sudo apt-get install csh
sudo apt-get install libstdc++5
sudo apt-get install libmotif3
sudo apt-get install libungif-bin

Install STK Engine (4DX)

Now that the required packages are laid down we can proceed with the regular installation. Uncompress the STKEngine802Linux.tgz archive by running the following command in your home directory:

tar -xvf '~/Desktop/STKEngine802Linux.tgz'

The archive expands to two directories: cdrom802Linux and cdrom802Disk2. Now we proceed with the install using the default settings:

cd ~/cdrom802Linux
cd ~/cdrom802Disk2

Please notice that you do not need admin rights for the install: the software gets installed locally in your home directory under the ~/agi directory.

Post-Install Steps

Once again Ubuntu is not officially supported. Therefore we have to make a few post-install tweaks to get things up and running.

Now edit your .bashrc startup file. At the end of the file add the following lines (see here if you are curious about MWNO_RIT):

export MWNO_RIT=true
export JAVA_HOME=/usr/java/jdk1.6.0_07

After changing your .bashrc file make sure you close your current terminal and re-open a new one. 

We also need the following symlink (if /usr/lib/ does not exist in the system you will get an error at runtime: "Unable to resolve function glXQueryExtension"):

sudo ln -s /usr/lib/ /usr/lib/

Our install also copies local versions of libz and libpng. On Ubuntu these libraries conflict with the versions provided with the system, so we need to "neutralize" them:

cd ~/agi/4DX/8.0.2/lib/LINUX_2_4_INTEL

One last thing we need to do is to fix the run scripts accompanying the java samples. These scripts reference the library from /usr/X11R6/lib. On ubuntu that library is at a different location: /usr/lib. So the following sed command will fix the scripts:

cd ~/agi/4DX/8.0.2/samples/Java/scripts/unix
sed -i 's/\/X11R6//' Run*

Getting a license

At this point we are ready to start using STK Engine (4DX). Obtain a free demo license by contacting our support. Make sure that you specify that you want to evaluate on Linux. You will receive a .lic file that you need to place in your home directory.

Up and running!

You are now ready to run! Use the following steps:

cd ~/agi/4DX/8.0.2/bin
. 4DXSetEnv

This will open the 4DXDemo C++ example. You can then open the demo scenario through the File/Demo Scenarios/Scenarios menu:

We can now also compile and run the Java examples:

cd ~/agi/4DX/8.0.2/samples/Java/scripts/unix

Here is a screenshot of the Java Sisp example:


Now that you are up and running you can browse on C++ & Java examples from the ~/agi/4DX/8.0.2/samples directory. You can also browse our help system using:

4DXhelp -4DX


  1. Hello:

    I’m interested in getting this running on Linux so I was pleased when I came across this posting. I totally understand that this is not supported officially. However, I’m a bit perplexed by the instructions. After install and in the directions in this file: Getting_Started_with_4DX.htm

    It says:

    Verifying Setup of Java Code Samples

    1. Open a new shell window.
    2. Copy the /4DX/8.0.2/samples/ to your home directory.
    3. cd /samples/Java/scripts/unix to go to the samples directory.
    4. Enter ./Compile to compile a sample programs.

    When I run the compile script, just about every line fails. The failures are due to the import agi.*; lines in the source code.

    Also I’m assuming I have the environment set up correctly… as seen here:

    [user@localhost ~]$echo $AGI_4DX_HOME

    So at this point I’m assuming I’m missing a jar with the agi.core, agi.stkx, yada, yada, yada, packages. Where can I find those packages? They didn’t come with TKEngine802Linux.tgz.

    Any assistance is greatly appreciated!

    Comment by Chris — February 1, 2010 @ 12:20 am

  2. Hello,

    These JAR files should have been installed under the $AGI_4DX_HOME/lib/LINUX_2_4_INTEL, so in your case the /usr/agi/4DX/8.0.2/lib/LINUX_2_4_INTEL directory. Here is how it looks on my Ubuntu machine:

    test4dx@test4dx-ubuntu:~/agi/4DX/8.0.2/lib/LINUX_2_4_INTEL$ ls *.jar
    agi.core.jar agi.javadocs.jar agi.stkobjects.jar agi.stkx.jar
    agi.jar agi.logging.jar agi.stkutil.jar agi.util.jar

    Can you confirm that these files are present in that directory?

    Also make sure that you run 4DXSetEnv in the new shell before trying to compile the Java examples. In the blog above this is done in the [Up and Running] section, just before running 4DXDemo.

    Let me know if that helps…


    Comment by Sylvain — February 1, 2010 @ 9:17 am

  3. Thanks Sylvain for the reply… yes, those files are there as you instructed. I don’t know why my file search didn’t turn those files up?! Oh well. At any rate, do I need to add $AGI_4DX_HOME/lib/LINUX_2_4_INTEL to the path or create a classpath variable for it?

    I ask because I have used a new shell (heck, I have even rebooted), and nothing with a import statement to one of those jars will compile.



    Comment by Chris — February 7, 2010 @ 3:45 pm

  4. Chris,

    The path should have been set by the 4DXSetEnv script. Have you run this script after starting the new shell? Also could you try to run 4DXDemo? It is located at $AGI_4DX_HOME/bin/LINUX_2_4_INTEL/4DXDemo. Does it run correctly?



    Comment by Sylvain — February 22, 2010 @ 8:17 am

  5. Thanks for the reply Sylvain.

    Sorry about missing that step to run 4DXSetEnv… thanks.

    When I try to run the demo as you asked, it fails with:

    ./4DXDemo: error while loading shared libraries: cannot open shared object file: No such file or directory

    I tried to google that and the only thing I found is a reference to

    Do I have to build mono now? If I missed that in the instructions, I apologize… I only loaded csh, stdc++5, & ungif beforehand. Openmotif was already installed on the box.


    Comment by Chris — March 2, 2010 @ 4:32 pm

  6. Hi Chris,

    No, you do not have to build mono. mono is only required if you want to run .Net assemblies on Linux.

    Most likely this error comes from a shared library required by and missing on your system. Which version of Linux are you using? What does the command [ldd -r] outputs (make sure you run it in the shell where you ran 4DXSetEnv)?



    Comment by Sylvain — March 11, 2010 @ 11:40 am

  7. Thanks again for the reply.

    I’ve already got this running on Ubuntu. However, I wanted to see if I could get this running on a non-debian distro. Our lab has a mix of OSes: Ubuntu, all sorts of Windows, Solaris, etc… so I do maintain a familiarity with Ubuntu. Personally, I hate Ubuntu with a passion. Everything runs around sudo or apt. It constrains a user to maintaining a system in their little cookie cutter format… and once upon a time after spending a day hacking sudo so I could get the otherwise not available (from apt that is) Java EE SDK installed on Ubuntu, I gave up and decided to use a rpm-based distro where one could put files where they wanted, get updates outside of apt, and where one can build software from the command line without any hassles (instead of tech support telling me the only way to make something work is ‘apt-get’).

    As you might expect, the command you asked me to run yields this:

    ldd -r
    ldd: ./ No such file or directory

    Changing or adding links on Linux isn’t really that big of a deal; I’ve had to do it to get a number of different pieces of software running. Heck, to get Java to work with Firefox one needs to modify a link when installing.

    But I’m perplexed that I cannot find squat online about what shared libs are needed by libAgAxContainer.

    Comment by Chris — March 19, 2010 @ 11:40 pm

  8. Hi Sylvain,

    I have exactly the same problem. Here is the output of running [ldd -r] in the bin directory.

    ldd: ./ No such file or directory

    Thanks in advance!

    Comment by Aleksey — May 3, 2010 @ 10:15 am

  9. Hi Aleksey & Chris,

    What is the current directory when you execute this command? This shared library should be in [$AGI_4DX_HOME/lib/LINUX_2_4_INTEL]. Also you guys might want to consider contacting me through our tech support ( and mention this discussion. It would provide a better/faster communication medium that the comments section for this blog article. We would be able to iterate much faster and get you guys up and running much faster. Once we get a resolution we can share the solution(s) here for everybody.



    Comment by Sylvain — May 4, 2010 @ 1:58 pm

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress